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 || [];