Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

Use store selectors in WorkspaceSection and apply initialSubTab on navigation

Gabriel Stein4569aacc357a
diff --git a/src/components/settings/WorkspaceSection.tsx b/src/components/settings/WorkspaceSection.tsx
index 8dd67162c..d09af3189 100644
--- a/src/components/settings/WorkspaceSection.tsx
+++ b/src/components/settings/WorkspaceSection.tsx
@@ -38,8 +38,13 @@ interface Props {
export default function WorkspaceSection({ initialSubTab }: Props) {
const { t } = useTranslation();
const { isSignedIn } = useAuth();
- const { workspaces, activeWorkspaceId, setActiveWorkspaceId, loaded, loading, error, refresh } =
- useWorkspaceStore();
+ const workspaces = useWorkspaceStore((s) => s.workspaces);
+ const activeWorkspaceId = useWorkspaceStore((s) => s.activeWorkspaceId);
+ const setActiveWorkspaceId = useWorkspaceStore((s) => s.setActiveWorkspaceId);
+ const loaded = useWorkspaceStore((s) => s.loaded);
+ const loading = useWorkspaceStore((s) => s.loading);
+ const error = useWorkspaceStore((s) => s.error);
+ const refresh = useWorkspaceStore((s) => s.refresh);
const [storedTab, setStoredTab] = useLocalStorage<string>(
"settings.workspaceTab",
SUB_TABS.includes(initialSubTab as WorkspaceTab) ? (initialSubTab as WorkspaceTab) : "members"
@@ -51,6 +56,14 @@ export default function WorkspaceSection({ initialSubTab }: Props) {
if (isSignedIn && !loaded) void refresh();
}, [isSignedIn, loaded, refresh]);
+ // The localStorage default only seeds the very first mount; external
+ // navigation (e.g. straight to billing) must land on every use.
+ useEffect(() => {
+ if (initialSubTab && SUB_TABS.includes(initialSubTab as WorkspaceTab)) {
+ setStoredTab(initialSubTab);
+ }
+ }, [initialSubTab, setStoredTab]);
+
if (!isSignedIn) return null;
// Shared by the empty and populated branches so the create→invite chain