#theme.palette.mode always returns light even when dark theme used

7 messages · Page 1 of 1 (latest)

versed oxide
#

I had the following code (running on Backstage 1.27)

const labelTheme = useMemo(
    () => (theme.palette.mode === 'dark' ? darkLabelTheme : lightLabelTheme),
    [theme.palette.mode],
  );

When attempting to upgrade to 1.29.2 theme.palette.mode always returns light. I'm using useTheme from @mui/material/styles as I'm using MUI v5 components.

Any idea what's changed or how to fix this?

fleet juniper
#

Hi @versed oxide, haven’t personally ran into this as I generally have avoided this pattern. I do think there was an issues logged about it.

versed oxide
#

Hey good timing as I JUST resolved it

#

running yarn dedupe…

#

And downgrading mui to 5.14

#

From 5.15 but not sure which of the two fixed it yet

fleet juniper
#

That sounds roughly what I remember about this.