fix(browser): clearing a search or loading a saved view no longer strands the browser - #958
Merged
Merged
Conversation
…ands the browser A bare nav-collection root below the top collection (e.g. /series under Publishers) has no breadcrumbs, and "/" resumes it. Only a search belongs there. Three frontend paths left the browser there after the search ended: - "Clear Filters and Search" (clearFilters(true)) assigned the reset search straight into state, skipping _validateSearch, so the redirect made on entering the search was never undone. - loadSavedSettings discarded the redirect _validateAndSaveSettings returned. A saved view without a search stayed at the search root. One with another top collection stayed on the old route, where the server's _validate_top_collection rewrote the view's top collection: a Folders view loaded at the Publishers root came back as Publishers. - _validateSearch only undid the redirect at the current lowestShownCollection. Showing a deeper level mid-search, or loading a saved search that shows one, left the old search root behind. clearFilters(true) now takes its redirect from _validateSearch, loadSavedSettings goes through setSettings, and clearing a search leaves any bare imprints/series/volumes root. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
The browser could end up stranded: the Top Collection setting says Publishers, but the route is a bare nav-collection root below it (e.g.
/series, noparentIds, no search). The backend sends one root crumb there,breadcrumbs.vuehides it as the current view, and its "Top" fallback only fires withparentIds. That leaves no way back up, and/resumes the same saved route. #957 fixed the backend source of this state. This PR fixes three frontend paths that reach it, all infrontend/src/stores/browser.js."Clear Filters and Search" (
clearFilters(true), fromempty.vue) assigned the resetsearchstraight into state and skipped_validateSearch. Entering a search redirects to the bare root oflowestShownCollection, and nothing undid that on clear. It now asks_validateSearchfor the redirect before the reset overwrites the search, then follows it instead of reloading in place.loadSavedSettingscalled_validateAndSaveSettingsand threw away the redirect it returned. Two effects:/series._validate_top_collectionrewrote it: a Folders view loaded at the Publishers root came back as Publishers (confirmed with a throwaway backend probe that got a 303 withtopCollection: publishers).It now goes through
setSettings, like every other settings change._validateSearchonly undid the search redirect when the route matched the currentlowestShownCollection. Showing a deeper level mid-search (e.g. turning on Volumes while searching at/series) left the user stranded. Honoring the saved-view redirect in (2) would have opened the same hole for a saved search whose show flags differ. Clearing a search now leaves any bareimprints/series/volumesroot. Barefolders/arcs/comicsroots are unaffected, since searching there never redirects.Reviewer notes
routeWithSettingsstill ignores the redirect on purpose, because it pushes its own route. It is now the only caller that does.clearFiltersandloadSavedSettingsskip the trailing settings PATCH, just assetSettingsalready does. The browse GET after the redirect sends the full settings, and the backend saves them.v2.5.1Fixes, next to fix(browser): an unresolvable collection redirects to the top, not its bare root #957's entry.Tests
browser-empty-clear-search.test.js: mountsempty.vuewith real Vuetify and runs real store actions (createTestingPinia,stubActions: false). The router and browser API are mocked. It clicks "Clear Filters and Search" from/series, from/series/5and at the top.browser-store-saved-settings.test.js: loads saved views mid-search, with a different top collection (Folders from the root, Publishers from inside a folder), with more show levels, and in place.browser-store-search-clear.test.js: adds a case for show flags changing mid-search, plus cases that folders/arcs/comics roots never redirect.Each new case failed before the fix. The show-flag cases also fail with only the old
_validateSearchcondition put back.make fix,make lintandmake testall pass: vitest 953/953, pytest 1569 passed with 1 expected failure. Not checked in a live browser, because another dev server held the ports.🤖 Generated with Claude Code