Skip to content

Commit

Permalink
Merge pull request #248 from MOV-AI/target-node-12-and-chrome-78
Browse files Browse the repository at this point in the history
Fixup withTheme
  • Loading branch information
quirinpa authored Sep 20, 2023
2 parents cab5266 + 53586d3 commit 08ebdc7
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/Components/HOCs/withTheme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ interface ThemeSub {
themeName: ThemeNameType;
ApplicationTheme: ApplicationThemeType;
getStyle: typeof defaultGetStyle;
created: boolean;
};

export
const themeSub = makeSub<ThemeSub>({
themeName: (window.localStorage.getItem("movai.theme") ?? "dark") as ThemeNameType,
ApplicationTheme: DefaultApplicationTheme,
getStyle: defaultGetStyle,
created: false,
});

const setTheme = themeSub.makeEmitNow((current: ThemeSub, themeName: ThemeNameType): ThemeSub => {
Expand Down Expand Up @@ -56,10 +54,9 @@ export default function withTheme(
changed = true;
}

if (!current.created) {
if (!current.ApplicationTheme[current.themeName].breakpoints) {
current = {
...current,
created: true,
ApplicationTheme: createThemes(current),
};
changed = true;
Expand Down

0 comments on commit 08ebdc7

Please sign in to comment.