Skip to content

feat: remember the current Settings tab across reloads - #517

Closed
NichCodes wants to merge 1 commit into
kikootwo:mainfrom
NichCodes:feature/settings-remember-tab
Closed

NichCodes wants to merge 1 commit into
kikootwo:mainfrom
NichCodes:feature/settings-remember-tab

Conversation

@NichCodes

Copy link
Copy Markdown
Contributor

Summary

Reloading the admin Settings page always went back to the first tab. The page now remembers the last tab you opened.

How it works

  • Clicking a tab saves it in localStorage (adminSettingsActiveTab).
  • After the settings load, the page reopens that tab, but only if the current backend mode shows it. For example, Authentication only exists in Audiobookshelf mode. Otherwise it falls back to the first tab.
  • The tab is saved when you click it, not from an effect, so the default tab shown on first render never overwrites the saved one.
  • If localStorage is unavailable (private mode, blocked storage), the page behaves as before.

Testing

  • New tests in tests/app/admin-settings.page.test.tsx:
    • reopens the saved tab after a reload;
    • ignores a saved tab the current backend mode doesn't show;
    • saves the tab you click.
  • admin-settings-indexers-locked and admin-settings-indexer-roundtrip now clear localStorage in beforeEach. Otherwise one test's saved tab would carry into the next.
  • Full suite passes: 6448 passed, 68 skipped, 0 failed.
  • docker compose build succeeds.
  • Docs: documentation/settings-pages.md.

Reloading the admin Settings page always went back to the first tab.
Store the tab the admin clicks in localStorage and reopen it once the
settings load, but only if the current backend mode shows that tab
(Authentication exists only in Audiobookshelf mode), else the first tab.

The tab is saved on click, not from an effect, so the default tab
rendered on mount never overwrites the stored one. The two indexer tab
tests now clear localStorage so one test's tab doesn't leak into the next.
@NichCodes NichCodes changed the title Remember the current Settings tab across reloads feat: remember the current Settings tab across reloads Nov 2, 2026
@kikootwo

kikootwo commented Nov 2, 2026

Copy link
Copy Markdown
Owner

@NichCodes thanks for this. I'm bringing it in with you as co-author, with one change: the tab goes in the page address (?tab=) instead of browser storage, like the other admin pages. A reload keeps the tab, back and forward work, and links elsewhere in the app can open a specific tab.

I'll close this one when it lands.

kikootwo added a commit that referenced this pull request Nov 2, 2026
)

Reloading the admin Settings page always went back to the first tab. The open tab now lives in the address, `?tab=`: a reload keeps it, back and forward move between tabs, and a link can open a specific tab. A click pushes a history entry with the native History API (synced by Next.js, no server round trip), so switching stays instant and unsaved edits are kept. An unknown tab, or one the backend mode does not show, shows the first tab and leaves the address alone.

Based on #517 by @NichCodes.

Co-authored-by: NichCodes <90598280+NichCodes@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kikootwo

kikootwo commented Nov 2, 2026

Copy link
Copy Markdown
Owner

@NichCodes thanks again. It's in now as #534 with you as co-author: the Settings tab is kept in the page address (?tab=), back and forward move between tabs, and an unknown tab opens the first one. It will be in the next release. Closing this one in favour of #534.

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.

2 participants