diff --git a/app/sessionStore.js b/app/sessionStore.js index e68797f478a..e3748ab1f46 100644 --- a/app/sessionStore.js +++ b/app/sessionStore.js @@ -296,6 +296,10 @@ module.exports.cleanAppData = (data, isShutdown) => { if (data.dragData) { delete data.dragData } + if (data.sync) { + // clear sync site cache + data.sync.objectsById = {} + } const clearSiteSettings = isShutdown && getSetting(settings.SHUTDOWN_CLEAR_SITE_SETTINGS) === true if (clearSiteSettings) { data.siteSettings = {} diff --git a/app/sync.js b/app/sync.js index a9126e004da..c3a597cb494 100644 --- a/app/sync.js +++ b/app/sync.js @@ -95,6 +95,11 @@ const appStoreChangeCallback = function (diffs) { const entry = state.getIn(statePath) const isSite = type === 'sites' + if (action === writeActions.CREATE && entry && entry.get('skipSync')) { + // Don't re-create objects that were fetched by sync + return + } + if (isSite && action === writeActions.DELETE && !entry) { // If we deleted the site, it is no longer availble in appState. // Find the corresponding objectId using the sync cache