Skip to content

Commit 23246b6

Browse files
correct prevThemeId
1 parent d323b66 commit 23246b6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

arduino-ide-extension/src/browser/dialogs/settings/settings-component.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -589,9 +589,10 @@ export class SettingsComponent extends React.Component<
589589
): void => {
590590
const { selectedIndex } = event.target.options;
591591
const theme = ThemeService.get().getThemes()[selectedIndex];
592-
const prevTheme = ThemeService.get().getCurrentTheme();
593-
if (theme && prevTheme) {
594-
this.setState({ themeId: theme.id, prevThemeId: prevTheme.id });
592+
const prevThemeId =
593+
this.state.prevThemeId || ThemeService.get().getCurrentTheme().id;
594+
if (theme && prevThemeId) {
595+
this.setState({ themeId: theme.id, prevThemeId: prevThemeId });
595596
}
596597
ThemeService.get().setCurrentTheme(theme.id);
597598
};

0 commit comments

Comments
 (0)