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 &&