chore(search): remove dead search-mode localStorage plumbing - #13124
Merged
cdrini merged 1 commit intoJul 10, 2026
Merged
Conversation
The `mode` (everything/ebooks) value is a leftover from the legacy search bar. Nothing reads it anymore: the radio buttons are gone, ebook filtering happens via explicit availability params, and the server ignores the `mode` query param entirely. Remove the vestiges: - SearchUtils.js (PersistentValue was only used for `mode`) and its test - ol.js no longer mirrors `?mode=` into localStorage on page load - SearchModal no longer appends `mode=` to /search and /search.json URLs This also stops search URLs from carrying a stale cross-tab `mode` value, the last confusing remnant of internetarchive#11960. Closes internetarchive#11960
cdrini
approved these changes
Jul 10, 2026
cdrini
left a comment
Collaborator
There was a problem hiding this comment.
Nice lgtm! I know the authors page still shows ?mode=ebooks, but it looks like its not wired with this in any way.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Closes #11960
Technical
The
mode(everything/ebooks) value is a leftover from the legacy search bar and is now fully dead:sessionStoragewith the URL as source of truth.modequery param has never been read server-side (verified in git history — even before the new search UI,worksearch/code.pyhad nomodehandling). The mode→has_fulltexttranslation always lived client-side in the legacySearchBar.js, which was removed in ac18f7a. External API clients that still sendmode=to/search.jsonare unaffected — the param was already ignored.But three vestiges survived and still leaked a stale
modevalue across tabs vialocalStorage(harmless, since nothing reads it — just confusing URL noise). This PR removes them:SearchUtils.jsdeleted — itsPersistentValueclass was only used formode(+ its test file)ol.jsno longer mirrors?mode=intolocalStorageon every page loadSearchModal.jsno longer appendsmode=to the/searchand/search.jsonURLs it buildsNet: −205 lines, and search URLs stop carrying a
modeparam that could contradict the actual filter state — the last remnant of the cross-tab bug in #11960.Note: stale
modekeys already in patrons' localStorage are simply left behind — nothing reads them, so no migration/cleanup code is needed.Safety checks (static)
SearchUtils,searchMode, orPersistentValuemodelocalStorage keymode=URLsnpm run test:js— 457 tests pass; eslint + pre-commit cleanTesting (live, local dev)
Rebuilt the JS bundle on this branch and exercised the full search flow in the browser:
localStorage.mode = 'ebooks'(simulating the stale cross-tab value from ebook vs everything radio button status not always correctly displayed on search page #11960), then loaded/?mode=everything→ localStorage untouched (old code would have overwritten it)/search.jsonrequests (results + readable count) returned 200 with nomodeparam, and the stale localStorage value did not leak into them; results rendered normally/search?q=...URL (nomode), results page rendered with the filter row/search?q=...&has_fulltext=trueas expected/search?q=...&mode=ebooks&has_fulltext=true→ page renders fine, toggle correctly shows ON (derived fromhas_fulltext,modeignored)my-books.jsdropper exception, unrelated)Stakeholders
@cdrini