[WEB-2532] fix: custom theme mutation logic (#5685)

* fix: custom theme mutation logic

* chore: update querySelector element
This commit is contained in:
Aaryan Khandelwal 2024-10-08 16:47:16 +05:30 committed by sriram veeraghanta
parent b97fcfb46d
commit daa06f1831
3 changed files with 15 additions and 43 deletions

View file

@ -52,13 +52,8 @@ const ProfileAppearancePage = observer(() => {
const applyThemeChange = (theme: Partial<IUserTheme>) => {
setTheme(theme?.theme || "system");
const customThemeElement = window.document?.querySelector<HTMLElement>("[data-theme='custom']");
if (theme?.theme === "custom" && theme?.palette && customThemeElement) {
applyTheme(
theme?.palette !== ",,,," ? theme?.palette : "#0d101b,#c5c5c5,#3f76ff,#0d101b,#c5c5c5",
false,
customThemeElement
);
if (theme?.theme === "custom" && theme?.palette) {
applyTheme(theme?.palette !== ",,,," ? theme?.palette : "#0d101b,#c5c5c5,#3f76ff,#0d101b,#c5c5c5", false);
} else unsetCustomCssVariables();
};