Keep workspace editor target selection

This commit is contained in:
Mohamed Boudra
2026-05-19 21:30:43 +07:00
parent 84fb7e9e06
commit ad9b149bf7
5 changed files with 155 additions and 20 deletions
@@ -19,6 +19,9 @@ export function resolvePreferredEditorId(
availableEditorIds: readonly EditorTargetId[],
storedEditorId: EditorTargetId | null | undefined,
): EditorTargetId | null {
if (storedEditorId === undefined) {
return null;
}
if (
storedEditorId &&
availableEditorIds.some((availableEditorId) => availableEditorId === storedEditorId)
@@ -50,7 +53,7 @@ export function usePreferredEditor() {
);
return {
preferredEditorId: data ?? null,
preferredEditorId: isPending ? undefined : (data ?? null),
isLoading: isPending,
updatePreferredEditor,
};