openlibrary icon indicating copy to clipboard operation
openlibrary copied to clipboard

Filters from the same category dissappear

Open raffchen opened this issue 2 years ago • 4 comments

Problem

Evidence / Screenshot

If we have more than one filter from the same category on a search like so: image

And then we add a filter from a different category using the side menu, then only the one that was added last stays: image

Adding the filters by manually editing the URL still works: image

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

  1. 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
  2. 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

raffchen avatar Mar 30 '24 04:03 raffchen

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 image

For my example URL from above, this is the result: image

raffchen avatar Mar 31 '24 17:03 raffchen

I've linked a draft fix for this that seems to work.

raffchen avatar Mar 31 '24 18:03 raffchen

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!

cdrini avatar Aug 19 '24 13:08 cdrini

This appears to no longer be an issue; it was incidentally fixed by #9397 .

cdrini avatar Aug 30 '24 21:08 cdrini