fix: use fresh settings in dark-mode observer and storage listener

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-26 21:18:48 -04:00
parent 7b0c80c0a4
commit 6e2aec39c9

View File

@@ -3,17 +3,17 @@
function startDarkModeObserver(settings) { function startDarkModeObserver(settings) {
var observer = new MutationObserver(function () { var observer = new MutationObserver(function () {
if (settings.darkMode === "auto") {
window.RedditTweaks.loadSettings().then(function (updated) { window.RedditTweaks.loadSettings().then(function (updated) {
if (settings.badgeLayout) { if (updated.darkMode === "auto") {
if (updated.badgeLayout) {
window.RedditTweaks.badgeTweak.updateColors(updated); window.RedditTweaks.badgeTweak.updateColors(updated);
} }
if (settings.cardLayout) { if (updated.cardLayout) {
window.RedditTweaks.cardTweak.updateSettings(updated); window.RedditTweaks.cardTweak.updateSettings(updated);
} }
});
} }
}); });
});
observer.observe(document.body, { observer.observe(document.body, {
attributes: true, attributes: true,
@@ -86,10 +86,10 @@
} }
window.RedditTweaks.loadSettings().then(function (updated) { window.RedditTweaks.loadSettings().then(function (updated) {
if (settings.badgeLayout) { if (updated.badgeLayout) {
window.RedditTweaks.badgeTweak.updateColors(updated); window.RedditTweaks.badgeTweak.updateColors(updated);
} }
if (settings.cardLayout) { if (updated.cardLayout) {
window.RedditTweaks.cardTweak.updateSettings(updated); window.RedditTweaks.cardTweak.updateSettings(updated);
} }
}); });