-
Notifications
You must be signed in to change notification settings - Fork 367
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
[Search UI] breaks when user makes simple URL modifications #1003
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
I still think this bugfix is important, it makes the SDK less brittle against what is from my perspective realistic user behavior. |
thanks for reporting the issue. Will add it to list of improvements |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
still think so, also getting a bit tired of the configuration of the issue bot... |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
still think so, also getting quite a bit more tired of the configuration of the issue bot... |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
justintimberlakestare.gif |
Describe the bug
With the default setup, the SDK breaks when the user modifies the URL to something that does not exactly match the format of the requestState object
To Reproduce
Steps to reproduce the behavior:
reproducible currently in the demo codesandbox environment here: https://codesandbox.io/s/github/elastic/search-ui/tree/main/examples/sandbox?from-embed=&initialpath=/elasticsearch&file=/src/pages/elasticsearch/index.js
Expected behavior
A more robust error handling, for example defaulting filters to an empty array when wrong typing is found.
Screenshots
Which backends and packages are you using:
Packages: [search-ui]
Additional info
What happens is that parseing of the URL is not robust, there is only a non-falsy check but that is not enough, as other SDK code assumes that the requestState properties actually have correct type.
Parsing is not robust here:
search-ui/packages/search-ui/src/URLManager.ts
Line 66 in d37d1bf
This SDK code here assumes filters to be an array (as it assumes filters.filter to be a function), which is is not in the reproduction scenario, and no safeguards exist against this:
search-ui/packages/search-ui/src/actions/clearFilters.ts
Line 15 in d37d1bf
The text was updated successfully, but these errors were encountered: