feat(snapshot): implement active workspace tab type tracking (#8487)

* feat(snapshot): implement active workspace tab type tracking and restoration

* feat(snapshot): introduce workspace tab types and update related logic
This commit is contained in:
Sid
2026-07-07 00:09:38 +05:30
committed by GitHub
parent 4ddf65c0c1
commit cbed13a346
6 changed files with 109 additions and 4 deletions

View File

@@ -30,6 +30,13 @@ const IGNORED_TAB_TYPES = new Set([
'v4-migration'
]);
export const WORKSPACE_TAB_UID_SUFFIX_BY_TYPE = {
workspaceOverview: 'overview',
workspaceEnvironments: 'environments'
};
export const WORKSPACE_TAB_TYPES = new Set(Object.keys(WORKSPACE_TAB_UID_SUFFIX_BY_TYPE));
export const SAVE_TRIGGERS = new Map([
['app/setSnapshotReady', null],
['tabs/addTab', null],
@@ -143,6 +150,9 @@ const normalizeWorkspaceSnapshotEntry = (pathname, entry = {}) => {
? entry.lastActiveCollectionPathname
: null,
sorting: typeof entry.sorting === 'string' ? entry.sorting : 'default',
activeWorkspaceTabType: WORKSPACE_TAB_TYPES.has(entry.activeWorkspaceTabType)
? entry.activeWorkspaceTabType
: null,
collections
};
};
@@ -226,6 +236,7 @@ export const hydrateSnapshotLookups = (snapshot = {}) => {
pathname: workspace.pathname,
lastActiveCollectionPathname: workspace.lastActiveCollectionPathname,
sorting: workspace.sorting,
activeWorkspaceTabType: workspace.activeWorkspaceTabType,
collections: workspace.collections
};