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:
@@ -9,7 +9,7 @@
|
|||||||
window.RedditTweaks.badgeTweak.apply(settings);
|
window.RedditTweaks.badgeTweak.apply(settings);
|
||||||
|
|
||||||
browser.storage.onChanged.addListener(function (changes) {
|
browser.storage.onChanged.addListener(function (changes) {
|
||||||
if (changes.enabled) {
|
if (changes.enabled && changes.enabled.newValue !== changes.enabled.oldValue) {
|
||||||
location.reload();
|
location.reload();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user