openlibrary icon indicating copy to clipboard operation
openlibrary copied to clipboard

10760/add global book filter

Open BearSunny opened this issue 1 year ago • 23 comments

Closes #10760

This PR aims to create a global filter with the following flow: UI change -> Save to localStorage for persistence across page loads -> Data are sent to backend -> Backend sets cookies -> On success, trigger carousels reload -> Carousels read preferences from localStorage -> Carousels use preferences to fetch filtered data from Solr.

Technical

This implementation already confirms that UI interaction and cookies work correctly. However, since I haven't tested it on carousels with loaded books yet, I cannot confirm that carousels are able to load properly.

P/S: I sincerely apologize for my inactivity over the past month since I was away for military service. If you could kindly share the instructions on how to load books for testing, I’d really appreciate it. Thank you so much!

BearSunny avatar Oct 07 '25 14:10 BearSunny

Looking at the javascript CI:

[lint:js]   1:32  error  'getGlobalPreferences' is defined but never used       no-unused-vars
[lint:js]   1:54  error  'onGlobalPreferencesChange' is defined but never used  no-unused-vars
[lint:js]   1:81  error  'mapPreferencesToBackend' is defined but never used    no-unused-vars
[lint:js]   3:7   error  'selectedLang' is assigned a value but never used      no-unused-vars
[lint:js] 
[lint:js] /home/runner/work/openlibrary/openlibrary/static/js/preferences.js
[lint:js]    6:9  error  Unexpected console statement  no-console
[lint:js]   22:9  error  Unexpected console statement  no-console
[lint:js]   43:9  error  Unexpected console statement  no-console
[lint:js]   60:9  error  Unexpected console statement  no-console
[lint:js]   71:9  error  Unexpected console statement  no-console

mekarpeles avatar Oct 16 '25 18:10 mekarpeles

Hi @mekarpeles, I’ve implemented the suggested fixes from my last PR. While testing by loading some books, it looks like they aren’t reflecting the updated preference logic. Could you please let me know if there are additional steps I should take, or if there might be a conflict between the new implementation and the existing codebase?

BearSunny avatar Nov 24 '25 01:11 BearSunny

Hey @mekarpeles, I have migrated this