Filters from the same category dissappear
Problem
Evidence / Screenshot
If we have more than one filter from the same category on a search like so:
And then we add a filter from a different category using the side menu, then only the one that was added last stays:
Adding the filters by manually editing the URL still works:
Relevant URL(s)
https://openlibrary.org/search?q=fantasy&mode=everything&subject_facet=Fiction&subject_facet=Fiction%2C+fantasy%2C+general&subject_facet=Fantasy
Reproducing the bug
- Search for a book and apply multiple filters from the same category, or go to https://openlibrary.org/search?q=fantasy&mode=everything&subject_facet=Fiction&subject_facet=Fiction%2C+fantasy%2C+general&subject_facet=Fantasy
- Using the side menu, add a filter from a different category, such as Language or Author
- Expected behavior: All of the filters from the Subjects category remain, and the new filter is also applied (like in the 3rd screenshot)
- Actual behavior: The new filter is applied, but all but one of the filters from the Subjects category disappear
Context
- Browser (Chrome, Safari, Firefox, etc): Chrome, Firefox
- OS (Windows, Mac, etc): Windows
- Logged in (Y/N): N
- Environment (prod, dev, local): prod
Notes from this Issue's Lead
Proposal & constraints
Related files
Stakeholders
After doing some digging, it looks like this is because of webpy's storify function. This is used in webpy's input function which we use in changequery.
https://github.com/webpy/webpy/blob/d3649322b85777b291ac2b7b3699fb6fc839e382/web/utils.py#L130-L141
For my example URL from above, this is the result:
I've linked a draft fix for this that seems to work.
Hi @raffchen apologies for the delay! Your approach touches a method that is used profusely throughout the codebase, so I need to fully understand the implications of the change (which involves understanding some web.py internals) and try to come up with some clever ways to test it. I haven't had the time to tackle that kind of task. Apologies for the delay!
This appears to no longer be an issue; it was incidentally fixed by #9397 .