Settings, Configuration, Statistics and Users kept the last sub-tab in localStorage, so every fresh tab opened Configuration on "Plex" as if that were its home. useTabPersistedState keeps it in sessionStorage (account-scoped): a reload and a trip to another page keep it, a new tab starts on the first sub-tab. The pre-selects (a Review link, the Google-link return) write the same store; a value an older build left in localStorage is cleared on first read.
16 lines
771 B
TypeScript
16 lines
771 B
TypeScript
import { LS, setTabRaw } from "./storage";
|
|
|
|
// The admin Users page's persisted-tab key + the Access-requests tab id, plus a helper to
|
|
// pre-select that tab before navigating there (a notification's "Review" link uses it —
|
|
// useTabPersistedState reads the key on mount, and the page mounts fresh on navigation).
|
|
//
|
|
// Kept out of AdminUsers.tsx so callers (App, NotificationsPanel) can pre-select the tab
|
|
// WITHOUT statically importing the — now lazy-loaded — admin page, which would otherwise pull
|
|
// it back into the main bundle and defeat the code-split.
|
|
export const ADMIN_USERS_TAB_KEY = LS.adminUsersTab;
|
|
const ADMIN_USERS_ACCESS_TAB = "access";
|
|
|
|
export function focusAccessRequestsTab(): void {
|
|
setTabRaw(ADMIN_USERS_TAB_KEY, ADMIN_USERS_ACCESS_TAB);
|
|
}
|