Persist active Planning interviews across embedded navigation while honoring explicit dismissal. - Store the active Planning session per project and restore it through the existing session loader. - Clear the saved active session for dismissals and terminal session actions. - Cover leave-and-return, completed-away, fresh-plan, and dismissed-error flows; document the behavior. - Add a patch changeset for the Planning session recovery fix. Files changed: .changeset/fn-8437-planning-leave-return-restore.md | 7 ++ docs/dashboard-guide.md | 2 +- packages/dashboard/app/components/PlanningModeModal.tsx | 51 ++++++++++++- packages/dashboard/app/components/__tests__/PlanningModeModal.planning-flow.test.tsx | 86 ++++++++++++++++++++++ packages/dashboard/app/hooks/__tests__/modalPersistence.test.ts | 18 +++++ packages/dashboard/app/hooks/modalPersistence.ts | 17 +++++ packages/dashboard/app/utils/__tests__/projectStorage.test.ts | 3 +- packages/dashboard/app/utils/projectStorage.ts | 1 + 8 files changed, 180 insertions(+), 5 deletions(-) Fusion-Task-Id: FN-8437 Fusion-Task-Lineage: 892aacb6-139e-4487-a40c-1bedd51237ea Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
93 lines
2.5 KiB
TypeScript
93 lines
2.5 KiB
TypeScript
export const GLOBAL_STORAGE_KEYS: string[] = [
|
|
"kb-dashboard-theme-mode",
|
|
"kb-dashboard-color-theme",
|
|
"kb-dashboard-view-mode",
|
|
"kb-dashboard-current-project",
|
|
"kb-dashboard-recent-projects",
|
|
"fn-agent-log-markdown",
|
|
"fn-agent-log-tool-output",
|
|
];
|
|
|
|
export const PROJECT_STORAGE_KEYS: string[] = [
|
|
"kb-dashboard-task-view",
|
|
"kb-dashboard-list-columns",
|
|
"kb-dashboard-hide-done",
|
|
"kb-dashboard-todo-hide-done",
|
|
"kb-dashboard-list-collapsed",
|
|
"kb-dashboard-selected-tasks",
|
|
"kb-dashboard-list-selected-task",
|
|
"kb-dashboard-list-sidebar-width",
|
|
"kb-dashboard-mailbox-sidebar-width",
|
|
"kb-dashboard-agents-sidebar-width",
|
|
"kb-dashboard-github-import-list-width",
|
|
"kb-dashboard-github-import-state",
|
|
"kb-quick-entry-text",
|
|
"kb-inline-create-text",
|
|
"fn-agent-view",
|
|
"kb-terminal-tabs",
|
|
"kb-planning-last-description",
|
|
"kb-planning-active-session",
|
|
"kb-subtask-last-description",
|
|
"kb-mission-last-goal",
|
|
"kb-usage-view-mode",
|
|
"kb-usage-hidden-windows",
|
|
"kb-usage-modal-size",
|
|
"kb-usage-provider-order",
|
|
"kb-chat-active-session",
|
|
"kb-dashboard-working-branch-filter",
|
|
"kb-dashboard-base-branch-filter",
|
|
"kb-capacity-risk-banner-dismissed",
|
|
"kb-github-setup-warning-missing-since",
|
|
"kb-files-line-numbers",
|
|
"kb-dashboard-dock-files-current",
|
|
"kb-dashboard-board-workflow-selection",
|
|
"fusion-plugin-dependency-graph:positions",
|
|
];
|
|
|
|
export function scopedKey(baseKey: string, projectId?: string): string {
|
|
if (typeof projectId !== "string" || projectId.length === 0) {
|
|
return baseKey;
|
|
}
|
|
|
|
return `kb:${projectId}:${baseKey}`;
|
|
}
|
|
|
|
export function getScopedItem(baseKey: string, projectId?: string): string | null {
|
|
if (typeof window === "undefined") {
|
|
return null;
|
|
}
|
|
|
|
const getItem = window.localStorage?.getItem;
|
|
if (typeof getItem !== "function") {
|
|
return null;
|
|
}
|
|
|
|
return getItem.call(window.localStorage, scopedKey(baseKey, projectId));
|
|
}
|
|
|
|
export function setScopedItem(baseKey: string, value: string, projectId?: string): void {
|
|
if (typeof window === "undefined") {
|
|
return;
|
|
}
|
|
|
|
const setItem = window.localStorage?.setItem;
|
|
if (typeof setItem !== "function") {
|
|
return;
|
|
}
|
|
|
|
setItem.call(window.localStorage, scopedKey(baseKey, projectId), value);
|
|
}
|
|
|
|
export function removeScopedItem(baseKey: string, projectId?: string): void {
|
|
if (typeof window === "undefined") {
|
|
return;
|
|
}
|
|
|
|
const removeItem = window.localStorage?.removeItem;
|
|
if (typeof removeItem !== "function") {
|
|
return;
|
|
}
|
|
|
|
removeItem.call(window.localStorage, scopedKey(baseKey, projectId));
|
|
}
|