-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(web): Handle duplicate library settings gracefully #6950
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
// Check so that exclusion pattern isn't duplicated | ||
if (!library.exclusionPatterns.includes(exclusionPatternToAdd)) { | ||
library.exclusionPatterns.push(exclusionPatternToAdd); | ||
exclusionPatterns = library.exclusionPatterns; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're doing that check in 3 different places or so. Not sure if I'm a huge fan of this...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We check both in the modal for add/edit and in the handle function. I think both are needed. I'll likely also add a check in the server to prevent duplicates submitted via API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option is to not do anything client side and auto dedupe server side instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need to dedupe client side because of the client-side bugs in #6694. I'll address the server side in another PR
…handle-duplicate-import-paths
Don't allow adding duplicate import paths. Disable save button if input is empty or duplicate. Add error text if duplicate path.
Add text saying import paths are empty
Also, the same thing for exclusion patterns