diff --git a/app/sessionStore.js b/app/sessionStore.js index b6dd3417a59..b877e4f00a7 100644 --- a/app/sessionStore.js +++ b/app/sessionStore.js @@ -39,7 +39,7 @@ const autofill = require('./autofill') const {navigatableTypes} = require('../js/lib/appUrlUtil') const Channel = require('./channel') const BuildConfig = require('./buildConfig') -const {isImmutable, makeImmutable, deleteImmutablePaths} = require('./common/state/immutableUtil') +const {isImmutable, isMap, makeImmutable, deleteImmutablePaths} = require('./common/state/immutableUtil') const {getSetting} = require('../js/settings') const platformUtil = require('./common/lib/platformUtil') const historyUtil = require('./common/lib/historyUtil') @@ -430,6 +430,19 @@ module.exports.cleanAppData = (immutableData, isShutdown) => { immutableData = immutableData.deleteIn(['ledger', 'locations']) } + // Remove windowState from perWindowState if there are no frames + if (perWindowStateList) { + perWindowStateList.forEach((immutablePerWindowState, i) => { + if (isMap(immutablePerWindowState)) { + if (immutablePerWindowState.has('frames')) { + if (!immutablePerWindowState.get('frames').size) { + immutableData = immutableData.deleteIn(['perWindowState', i]) + } + } + } + }) + } + return immutableData }