From e00f347219023d2488dc3ef65a62d04178497762 Mon Sep 17 00:00:00 2001 From: codeSafari10 Date: Tue, 25 Jun 2024 09:30:04 +0530 Subject: [PATCH] fix: copy before mutating the theme Signed-off-by: codeSafari10 --- src/theme/theme.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/theme/theme.ts b/src/theme/theme.ts index 71a42e9b..f0e56081 100644 --- a/src/theme/theme.ts +++ b/src/theme/theme.ts @@ -7,13 +7,17 @@ export const drawerWidth = 240; export const createCustomTheme = (mode: PaletteMode, brandPalette?: Interactiveness) => { const basePalette = mode == 'light' ? lightModePalette : darkModePalette; - const themePalette = brandPalette - ? Object.assign({}, basePalette, { - background: { - brand: brandPalette - } - }) - : basePalette; + + const themePalette = { + ...basePalette, + background: { + ...(basePalette.background || {}), + brand: { + ...((basePalette?.background?.brand || {}) as Interactiveness), + ...(brandPalette || {}) + } + } + }; return createTheme({ palette: {