-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix: Fix the problem that the theme color display is abnormal after t… #8330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -327,6 +327,7 @@ const search = async () => { | |
| form.apiKeyValidityTime = res.data.apiKeyValidityTime; | ||
| form.hideMenu = res.data.hideMenu; | ||
| form.systemIP = res.data.systemIP; | ||
| form.theme = res.data.theme; | ||
|
|
||
| if (isMasterProductPro.value) { | ||
| const xpackRes = await getXpackSetting(); | ||
|
|
@@ -340,7 +341,7 @@ const search = async () => { | |
| form.proxyDocker = xpackRes.data.proxyDocker; | ||
| } | ||
| } else { | ||
| form.theme = globalStore.themeConfig.theme || res.data.theme || 'light'; | ||
| globalStore.themeConfig.theme = form.theme; | ||
| } | ||
| }; | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code snippet you've provided contains a few potential issues:
To fix this issue, update
Additionally, there's no need to reassign Optimization suggestion: After making these changes, the corrected code should look like this: const search = async () => {
// ... previous lines ...
globalStore.themeConfig.theme = form.theme;
if (isMasterProductPro.value) {
const xpackRes = await getXpackSetting();
// ... rest of the code ...
} else {
// Reuse the value of form.theme stored previously
// No need to assign it here again.
}
// Further processing using form.theme...
};With these updates, your code will behave correctly and efficiently. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The provided
getSettingfunction is largely consistent with other code patterns, but there's one small optimization suggestion:Replace the last line of your change block with the corrected version to ensure all necessary fields are included in the object you're passing to
globalStore.setThemeConfig(). This makes sure that the updated configuration includes both the new theme and the new panel name, rather than just merging them without explicitly specifying the field names.