Skip to content

Commit 1a2fee3

Browse files
authored
fix: apparence settings is not correctly applied to the dom (#450)
**Describe the pull request** This pull request addresses an issue where appearance settings are not correctly applied to the DOM. The fix involves refining the process through which these settings are propagated to the DOM, ensuring that user-specified appearance configurations are accurately reflected. By resolving this issue, we enhance the application's responsiveness to user settings and improve the overall user experience. **Checklist** - [x] I have made the modifications or added tests related to my PR - [x] I have run the tests and linters locally and they pass - [x] I have added/updated the documentation for my RP
1 parent e9db8e9 commit 1a2fee3

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

web/ui/src/contexts/currentUser.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,15 @@ export const MeProvider: React.FC<MeProviderProps> = ({
124124
// to avoid a flash of the default theme on page load
125125
// Move it to this hook to prevent duplicated provider with same behaviour.
126126
useEffect(() => {
127-
if (me.me.settings && me.me.settings.theme === Theme.DARK) {
127+
if (me.me.settings.theme === Theme.DARK) {
128128
document.documentElement.classList.add('dark', 'bg-slate-900');
129129
} else if (
130-
(!me.me.settings || me.me.settings.theme === Theme.AUTO) &&
130+
me.me.settings.theme === Theme.AUTO &&
131131
window.matchMedia('(prefers-color-scheme: dark)').matches
132132
) {
133133
document.documentElement.classList.add('dark', 'bg-slate-900');
134+
} else {
135+
document.documentElement.classList.remove('dark', 'bg-slate-900');
134136
}
135137
}, [me]);
136138

web/ui/src/pages/settings/apparence.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ const ApparenceSettingPage: NextPage<PageProps> = () => {
5959
<SelectInput
6060
className="flex-1"
6161
objects={Object.values(ClusterMapAvatarSize)}
62-
selectedValue={settings.clusterMapAvatarSize}
62+
selectedValue={
63+
settings.clusterMapAvatarSize || ClusterMapAvatarSize.AUTO
64+
}
6365
defaultValue={ClusterMapAvatarSize.AUTO}
6466
onChange={(value) =>
6567
updateSettings({

0 commit comments

Comments
 (0)