From 449f86e5ef7cfb4da1e2d10105fa95a34ffa86c1 Mon Sep 17 00:00:00 2001 From: tophf Date: Mon, 15 May 2017 13:42:20 +0300 Subject: [PATCH] rework 4df35b82: clear the different style's id --- backup/fileSaveLoad.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/backup/fileSaveLoad.js b/backup/fileSaveLoad.js index 501c1aa0..9ebd7f62 100644 --- a/backup/fileSaveLoad.js +++ b/backup/fileSaveLoad.js @@ -102,10 +102,18 @@ function importFromString(jsonString) { item.name = item.name.trim(); const byId = BG.cachedStyles.byId.get(item.id); const byName = oldStylesByName.get(item.name); - const oldStyle = byId && sameStyle(byId, item) ? byId : byName; oldStylesByName.delete(item.name); - if (oldStyle == byName && byName) { + let oldStyle; + if (byId) { + if (sameStyle(byId, item)) { + oldStyle = byId; + } else { + item.id = null; + } + } + if (!oldStyle && byName) { item.id = byName.id; + oldStyle = byName; } const oldStyleKeys = oldStyle && Object.keys(oldStyle); const metaEqual = oldStyleKeys &&