Unverified Commit a9b19e99 authored by 陈帅's avatar 陈帅 Committed by GitHub

Merge pull request #4373 from kaoding/master

 防止每次刷新都要“切换主题”
parents 3916692c d8b6227b
...@@ -104,7 +104,7 @@ const SettingModel: SettingModelType = { ...@@ -104,7 +104,7 @@ const SettingModel: SettingModelType = {
}); });
const { primaryColor, colorWeak } = setting; const { primaryColor, colorWeak } = setting;
if (state.primaryColor !== primaryColor) { if (primaryColor && state.primaryColor !== primaryColor) {
updateTheme(primaryColor); updateTheme(primaryColor);
} }
updateColorWeak(!!colorWeak); updateColorWeak(!!colorWeak);
...@@ -133,13 +133,13 @@ const SettingModel: SettingModelType = { ...@@ -133,13 +133,13 @@ const SettingModel: SettingModelType = {
} }
}); });
const { primaryColor, colorWeak, contentWidth } = payload; const { primaryColor, colorWeak, contentWidth } = payload;
if (state.primaryColor !== primaryColor) { if (primaryColor && state.primaryColor !== primaryColor) {
updateTheme(primaryColor); updateTheme(primaryColor);
} }
if (state.contentWidth !== contentWidth && window.dispatchEvent) { if (state.contentWidth !== contentWidth && window.dispatchEvent) {
window.dispatchEvent(new Event('resize')); window.dispatchEvent(new Event('resize'));
} }
updateColorWeak(colorWeak); updateColorWeak(!!colorWeak);
window.history.replaceState(null, 'setting', urlParams.href); window.history.replaceState(null, 'setting', urlParams.href);
return { return {
...state, ...state,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment