Skip to content

Commit

Permalink
Remove perWindowState from immutableData if there are no frames in it
Browse files Browse the repository at this point in the history
  • Loading branch information
syuan100 authored and bsclifton committed Nov 20, 2017
1 parent 080820a commit 5d30039
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion app/sessionStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 5d30039

Please sign in to comment.