-
Notifications
You must be signed in to change notification settings - Fork 358
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
Fixes invalid regexp scenario #1081
Conversation
filteredSubjects = filteredSubjects.filter(x => uiSettings.schemaList.showSoftDeleted || (!uiSettings.schemaList.showSoftDeleted && !x.isSoftDeleted)) | ||
.filter(x => x.name.toLowerCase().match(quickSearchRegExp)); | ||
} catch (e) { | ||
console.warn('Invalid expression') |
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.
Ideally we should handle or rethrow the error or capture the exception. Maybe we should also check that the regexp should run, if there is no uiSettings.schemaList.quickSearch
for example?
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.
@malinskibeniamin based on what I found there is no other way to check whether regexp is valid other than trying to compose it and catch with an exception. IF it's valid, we filter on it, if it's not valid, we keep the original array.
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.
const filteredSubjects = api.schemaSubjects | ||
.filter(x => uiSettings.schemaList.showSoftDeleted || (!uiSettings.schemaList.showSoftDeleted && !x.isSoftDeleted)) | ||
.filter(x => x.name.toLowerCase().match(quickSearchRegExp)); | ||
let filteredSubjects = api.schemaSubjects |
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.
lint?
No description provided.