Skip to content

Conversation

robertky
Copy link
Member

What changed

  • Save the current search URL, visible result count and scroll position before opening an album in the same tab.
  • On return, fetch any previously visible result pages and restore the result count and scroll position.
  • Ignore modified clicks, new-tab links and non-album navigation.
  • Add hook/storage tests and a Playwright browser-back regression test.
  • Record AI-assisted work in docs/AI-USAGE.md.

Verification

  • pnpm format:check
  • pnpm lint
  • pnpm typecheck
  • pnpm test (client: 214 passed; server: 86 passed, 56 PostgreSQL-backed tests skipped because no TEST_DATABASE_URL is configured locally)
  • pnpm build
  • Full pnpm --filter @t19/e2e exec playwright test against the isolated seeded test database — 8 passed.
  • Additional isolated browser test against the 500-album catalog: after loading 40 results and returning from an album, all 40 results and the exact scroll position were restored.

Closes #121.

@robertky robertky requested a review from a team as a code owner November 23, 2026 12:45
erikhfj
erikhfj previously approved these changes Nov 23, 2026
Copy link
Member

@erikhfj erikhfj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean implementation of #121: validates sessionStorage payloads safely, ignores modified/new-tab/non-album clicks, reloads previously visible pages before restoring scrollY and clearing the saved state, and covers it with unit, hook, and Playwright back-navigation tests. CI is green — approving!

(Small non-blocking note: if the user submits a different search/filter while saved pages are still restoring, returnState.current could also check saved.url === ${window.location.pathname}${window.location.search}`` and clear itself on mismatch.)

erikhfj
erikhfj previously approved these changes Nov 23, 2026
Copy link
Member

@erikhfj erikhfj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-approving after clean merge with main.

Copy link
Member

@erikhfj erikhfj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved the 1-line docs/AI-USAGE.md merge conflict with main after #120 merged and re-approved.

@erikhfj erikhfj merged commit 77e5db7 into main Nov 23, 2026
3 checks passed
@erikhfj erikhfj deleted the fix/121-back-navigation-state branch November 23, 2026 20:16
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Preserve loaded search results when returning from album detail
2 participants