Skip to content

fix(browser): clearing a search or loading a saved view no longer strands the browser - #958

Merged
ajslater merged 1 commit into
developfrom
claude/focused-kepler-7e73d3
Sep 29, 2026
Merged

ajslater merged 1 commit into
developfrom
claude/focused-kepler-7e73d3

Conversation

@ajslater

Copy link
Copy Markdown
Owner

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, no parentIds, no search). The backend sends one root crumb there, breadcrumbs.vue hides it as the current view, and its "Top" fallback only fires with parentIds. 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 in frontend/src/stores/browser.js.

  1. "Clear Filters and Search" (clearFilters(true), from empty.vue) assigned the reset search straight into state and skipped _validateSearch. Entering a search redirects to the bare root of lowestShownCollection, and nothing undid that on clear. It now asks _validateSearch for the redirect before the reset overwrites the search, then follows it instead of reloading in place.

  2. loadSavedSettings called _validateAndSaveSettings and threw away the redirect it returned. Two effects:

    • A saved view without a search, loaded mid-search, stayed at /series.
    • A view with another top collection stayed on the old route. There the server's _validate_top_collection rewrote it: a Folders view loaded at the Publishers root came back as Publishers (confirmed with a throwaway backend probe that got a 303 with topCollection: publishers).

    It now goes through setSettings, like every other settings change.

  3. _validateSearch only undid the search redirect when the route matched the current lowestShownCollection. 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 bare imprints / series / volumes root. Bare folders / arcs / comics roots are unaffected, since searching there never redirects.

Reviewer notes

  • routeWithSettings still ignores the redirect on purpose, because it pushes its own route. It is now the only caller that does.
  • On the redirect branch, clearFilters and loadSavedSettings skip the trailing settings PATCH, just as setSettings already does. The browse GET after the redirect sends the full settings, and the backend saves them.
  • The NEWS line is under v2.5.1 Fixes, 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: mounts empty.vue with 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/5 and 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 _validateSearch condition put back.

make fix, make lint and make test all 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

…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>
@ajslater
ajslater merged commit 7c0f8e3 into develop Sep 29, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant