From bec1f8b3a9bf88e7e3ecdeb46e5975c892c56745 Mon Sep 17 00:00:00 2001 From: mkljczk Date: Fri, 6 Dec 2024 11:32:40 +0100 Subject: [PATCH] pl-fe: only update if changed(?) Signed-off-by: mkljczk --- packages/pl-fe/src/features/preferences/index.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/pl-fe/src/features/preferences/index.tsx b/packages/pl-fe/src/features/preferences/index.tsx index 30e7bfd69..964e9c831 100644 --- a/packages/pl-fe/src/features/preferences/index.tsx +++ b/packages/pl-fe/src/features/preferences/index.tsx @@ -112,6 +112,8 @@ const Preferences = () => { const plFeConfig = usePlFeConfig(); const instance = useInstance(); + const brandColor = settings.theme?.brandColor || plFeConfig.brandColor || '#d80482'; + const onSelectChange = (event: React.ChangeEvent, path: string[]) => { dispatch(changeSetting(path, event.target.value, { showAlert: true })); }; @@ -124,10 +126,10 @@ const Preferences = () => { dispatch(changeSetting(key, checked)); }; - const onBrandColorChange = (brandColor: string) => { - if (!settings.theme?.brandColor && brandColor === (plFeConfig.brandColor || '#d80482')) return; + const onBrandColorChange = (newBrandColor: string) => { + if (!settings.theme?.brandColor && newBrandColor === brandColor) return; - dispatch(changeSetting(['theme', 'brandColor'], brandColor, { showAlert: true, save: false })); + dispatch(changeSetting(['theme', 'brandColor'], newBrandColor, { showAlert: true, save: false })); debouncedSave(dispatch); }; @@ -173,7 +175,7 @@ const Preferences = () => { onBrandColorChange(palette['500'])} allowTintChange={false} />