diff --git a/src/models/setting.ts b/src/models/setting.ts index d0d76da7b31cba322c4053dacb6b1df8ff002ee9..8e2695bd53a88784e7ab09d467523e791f3cca82 100644 --- a/src/models/setting.ts +++ b/src/models/setting.ts @@ -104,7 +104,7 @@ const SettingModel: SettingModelType = { }); const { primaryColor, colorWeak } = setting; - if (state.primaryColor !== primaryColor) { + if (primaryColor && state.primaryColor !== primaryColor) { updateTheme(primaryColor); } updateColorWeak(!!colorWeak); @@ -133,13 +133,13 @@ const SettingModel: SettingModelType = { } }); const { primaryColor, colorWeak, contentWidth } = payload; - if (state.primaryColor !== primaryColor) { + if (primaryColor && state.primaryColor !== primaryColor) { updateTheme(primaryColor); } if (state.contentWidth !== contentWidth && window.dispatchEvent) { window.dispatchEvent(new Event('resize')); } - updateColorWeak(colorWeak); + updateColorWeak(!!colorWeak); window.history.replaceState(null, 'setting', urlParams.href); return { ...state,