From 52bbcafd983dfb7709db6d697db859b7f543d423 Mon Sep 17 00:00:00 2001 From: yan Date: Mon, 12 Jun 2017 16:52:21 -0700 Subject: [PATCH] follow ups to fix for #9308 fix https://github.com/brave/browser-laptop/issues/9405 fix https://github.com/brave/browser-laptop/issues/9404 --- app/sessionStore.js | 4 ++++ app/sync.js | 5 +++++ 2 files changed, 9 insertions(+) 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