fix: prevent page reload on color/preset saves

saveSettings() writes all keys including 'enabled', which triggered
the storage.onChanged reload check even when enabled didn't actually
change. Compare oldValue vs newValue so the reload only fires when
the enabled state genuinely toggles.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-26 18:17:33 -04:00
parent f78e60b723
commit 37c142f6e6

View File

@@ -9,7 +9,7 @@
window.RedditTweaks.badgeTweak.apply(settings);
browser.storage.onChanged.addListener(function (changes) {
if (changes.enabled) {
if (changes.enabled && changes.enabled.newValue !== changes.enabled.oldValue) {
location.reload();
return;
}