Skip to content

Commit

Permalink
fix: copy before mutating the theme
Browse files Browse the repository at this point in the history
Signed-off-by: codeSafari10 <[email protected]>
  • Loading branch information
codeSafari10 committed Jun 25, 2024
1 parent 827e63d commit e00f347
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/theme/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit e00f347

Please sign in to comment.