-
Notifications
You must be signed in to change notification settings - Fork 332
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(recent-searches): escape highlighted query regex #387
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 9276504:
|
packages/autocomplete-plugin-recent-searches/src/usecases/localStorage/search.ts
Outdated
Show resolved
Hide resolved
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.
I think the replaceAll option is more suitable, since it can be polyfilled
waiting for @francoischalifour's opinion before merging |
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.
Great catch—thank you!
Summary
The previous RegEx was not escaping parentheses or question marks in recent searches.
Actual behavior
invalid regex
Amazon?
result isAmazon??
)and then throwing error while trying to replace the `item.query