fix: wrong advanced filter formatting handling #1495
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The symptoms and problem
We have found a bug with the advanced index This shouldn't happen but it happened to some of our users, so we need a way to handle it to prevent an error if it happens again.
So lets say you navigate to this url: http://localhost:3000/assets?status=AVAILABLE
But you have advanced index mode active.
The params structure in the advanced index is different, however status is a proper param name. So it was crashing because it was trying to parse AVAILABLE as a advanced index filtering param but it doesnt have the correct format.
THe format in the url above is the one we use on simple index. I am not sure how this leaked to the url params in the case of our user. My only thought is that they already had advanced mode active and they typed in their url bar and this was the automatic URL suggested.
The Fix
Implemented some functions that validate the format of the params values for params which are within the column filter names. If there are some broken ones, we remove them and reload the page with the cookie updated.