AprilSylph / XKit-Rewritten

🧰 The enhancement suite for Tumblr's new web interface
GNU General Public License v3.0
293 stars 48 forks source link

Importing backup keeps old storage keys #1191

Open marcustyphoon opened 1 year ago

marcustyphoon commented 1 year ago

Platform

MacOS 13.5 arm64

Browser

Chrome 115.0.5790.170

Addon version

master

Details

https://github.com/AprilSylph/XKit-Rewritten/blob/248912f7c22e5c129a52563acde76a7b4e65b620/src/browser_action/render_backup.js#L57-L58

When one imports a backup of their preferences, any keys in the backup get set, but any keys not in the backup do not get removed, as one might expect. (adding await browser.storage.local.clear(); would implement this behavior.)

Of course, there are probably situations where one might want the current, merge-my-import-into-my-current-preferences behavior, honestly; one could argue that this is only sort of a bug. It would probably be way too confusing to implement two different restore buttons that allow the user to pick either behavior and that only appear in the case where the pasted backup does not contain some of the keys which are currently set, though it's not like it's hard.

Charlignon commented 1 year ago

What about clearing the storage every time and just adding a message like "this will override your existing configuration" in the import copy ?