feat(FN-2269): migrate dashboard session selection to global settings

- Add global settings schema/types fields for persisted dashboard session state (selected project and node)
- Refactor NodeContext and current-project hooks to read/write project and node selection via global settings instead of project-local state
- Update App wiring to use the new selection flow across dashboard startup and switching behavior
- Add and expand dashboard tests for NodeContext, useCurrentProject, and view-state persistence behavior
This commit is contained in:
Fusion
2026-04-22 17:12:27 -07:00
committed by gsxdsm
parent 313a5e6385
commit e079704211
9 changed files with 602 additions and 118 deletions

View File

@@ -47,6 +47,9 @@ export const DEFAULT_GLOBAL_SETTINGS = {
settingsSyncAuth: false,
settingsSyncInterval: 900000,
settingsSyncConflictResolution: "last-write-wins",
// Dashboard session state (persisted to global settings for PWA/offline restore)
dashboardCurrentNodeId: undefined,
dashboardCurrentProjectIdByNode: undefined,
} satisfies CompleteSettings<GlobalSettings>;
/** Default values for project-level settings. */

View File

@@ -1027,6 +1027,16 @@ export interface GlobalSettings {
* - "keep-remote": Accept the remote version on conflict
* Default: "last-write-wins". */
settingsSyncConflictResolution?: "last-write-wins" | "always-ask" | "keep-local" | "keep-remote";
/** Currently selected dashboard node ID. Used to restore the last-viewed node
* on fresh browser/PWA sessions. Null or undefined means viewing the local node.
* Persisted to global settings so it survives across browser restarts. */
dashboardCurrentNodeId?: string;
/** Map of node ID to the last-selected project ID for that node.
* The key is the node ID (use `"local"` for the local node).
* Persisted to global settings so project context is restored on fresh sessions.
* Clear individual entries by setting them to `undefined` (omitting from update).
* Clearing all entries returns the dashboard to overview mode. */
dashboardCurrentProjectIdByNode?: Record<string, string>;
}
/**