From 45ecacfb0454d5f8abff67b8ea6b2723d8c10cca Mon Sep 17 00:00:00 2001 From: "mr. m" Date: Sun, 25 Jan 2026 18:23:07 +0100 Subject: [PATCH] feat: Make sure to prioritize last session state before closed windows, b=no-bug, c=no-component --- src/zen/sessionstore/ZenSessionManager.sys.mjs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/zen/sessionstore/ZenSessionManager.sys.mjs b/src/zen/sessionstore/ZenSessionManager.sys.mjs index aeed984ca..162448958 100644 --- a/src/zen/sessionstore/ZenSessionManager.sys.mjs +++ b/src/zen/sessionstore/ZenSessionManager.sys.mjs @@ -286,6 +286,9 @@ export class nsZenSessionManager { spaces: this._migrationData?.spaces || [], }; } + if (!initialState?.windows?.length && initialState?.lastSessionState) { + initialState = { ...initialState.lastSessionState }; + } // There might be cases where there are no windows in the // initial state, for example if the user had 'restore previous // session' disabled before migration. In that case, we try @@ -301,14 +304,11 @@ export class nsZenSessionManager { } if (!initialState?.windows?.length) { initialState ||= {}; - let lastSessionState = initialState.lastSessionState || {}; - initialState.windows = lastSessionState.windows?.length - ? [...lastSessionState.windows] - : [ - { - tabs: [], - }, - ]; + initialState.windows = [ + { + tabs: [], + }, + ]; } for (const winData of initialState?.windows || []) { winData.spaces = this._migrationData?.spaces || [];