Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

fix(settings): retain About subpage across shell changes

Abdurrahman Fakhrul015582f1aea4
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index b8574ad7..03a1ae4c 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -8,6 +8,7 @@ this is the *what*, and it is what Settings → Account → About shows as “Wh
**Fixed**
+- `settings` retain About subpage across shell changes
- `ui` preserve external editor height on short screens
- `n8n` keep frame controls stable during refresh
- `ui` surface refresh and persistence failures
diff --git a/frontend/slices/os-settings/app.tsx b/frontend/slices/os-settings/app.tsx
index c4efa4b5..a439668c 100644
--- a/frontend/slices/os-settings/app.tsx
+++ b/frontend/slices/os-settings/app.tsx
@@ -3,7 +3,7 @@
import { useSearchParams } from "next/navigation";
import { initialAboutPage } from "./lib/about-pages";
import { sectionFromSearch } from "./lib/sections";
-import { useEffect, useState } from "react";
+import { useCallback, useEffect, useState } from "react";
import { useAppearance, effectiveServerTarget } from "@/lib/appearance";
import { useSession } from "@/features/auth";
import { IS_DEMO } from "@/lib/demo";
@@ -35,6 +35,7 @@ export default function OsSettings({ winId }: { winId?: string }) {
const [active, setActive] = useFeatureState<SectionId | null>(winId, "settings-section",
initial ?? (surface === "mobile" ? null : "appearance"),
);
+ useEffect(() => { if (winId) setActive(current => current); }, [setActive, winId]);
const [draftName] = useFeatureState(winId, "provider-name", "");
const [draftUrl] = useFeatureState(winId, "provider-url", "");
const [draftModels] = useFeatureState(winId, "provider-models", "");
@@ -85,14 +86,16 @@ export default function OsSettings({ winId }: { winId?: string }) {
[tweaks.theme, tweaks.preset, tweaks.device, tweaks.fontScale, tweaks.wallpaper, tweaks.wallpaperImage, tweaks.server.mode, serverTarget?.label, model],
);
+ const selectSection = useCallback((next: SectionId | null) => {
+ if (next !== active && sensitiveDirty && !window.confirm("Discard the unsaved API key or JSON?")) return;
+ if (next !== active) setSensitiveDirty(false);
+ setActive(next);
+ }, [active, sensitiveDirty, setActive]);
+
return (
<SettingsWindowContext.Provider value={{ winId, setSensitiveDirty }}>
- <AboutPageState initial={initialAboutPage(initial ?? null, params.get("page"))}>
- <SettingsShell active={active} onSelect={(next) => {
- if (next !== active && sensitiveDirty && !window.confirm("Discard the unsaved API key or JSON?")) return;
- if (next !== active) setSensitiveDirty(false);
- setActive(next);
- }} />
+ <AboutPageState winId={winId} initial={initialAboutPage(initial ?? null, params.get("page"))}>
+ <SettingsShell active={active} onSelect={selectSection} />
</AboutPageState>
</SettingsWindowContext.Provider>
);
diff --git a/frontend/slices/os-settings/components/about-page-state.tsx b/frontend/slices/os-settings/components/about-page-state.tsx
index b422cd85..5ebcf8c5 100644
--- a/frontend/slices/os-settings/components/about-page-state.tsx
+++ b/frontend/slices/os-settings/components/about-page-state.tsx
@@ -1,6 +1,7 @@
"use client";
-import { createContext, useContext, useMemo, useState, type ReactNode } from "react";
+import { createContext, useContext, useEffect, useMemo, type ReactNode } from "react";
+import { useFeatureState } from "@/features/appshell";
import type { AboutPage } from "../lib/about-pages";
type AboutPageContextValue = {
@@ -10,9 +11,10 @@ type AboutPageContextValue = {
const AboutPageContext = createContext<AboutPageContextValue | null>(null);
-export function AboutPageState({ initial = "overview", children }: { initial?: AboutPage; children: ReactNode }) {
- const [page, setPage] = useState<AboutPage>(initial);
- const value = useMemo(() => ({ page, setPage }), [page]);
+export function AboutPageState({ initial = "overview", winId, children }: { initial?: AboutPage; winId?: string; children: ReactNode }) {
+ const [page, setPage] = useFeatureState<AboutPage>(winId, "settings-about-page", initial);
+ useEffect(() => { if (winId) setPage(current => current); }, [setPage, winId]);
+ const value = useMemo(() => ({ page, setPage }), [page, setPage]);
return <AboutPageContext.Provider value={value}>{children}</AboutPageContext.Provider>;
}