Selaa lähdekoodia

Merge pull request #4606 from ian-r-rose/fix_initial_theme_toggle

Initially set the currentTheme variable correctly.
Afshin Darian 7 vuotta sitten
vanhempi
commit
6164b07685
1 muutettua tiedostoa jossa 2 lisäystä ja 1 poistoa
  1. 2 1
      packages/apputils-extension/src/index.ts

+ 2 - 1
packages/apputils-extension/src/index.ts

@@ -176,7 +176,7 @@ const themes: JupyterLabPlugin<IThemeManager> = {
     // Keep a synchronously set reference to the current theme,
     // since the asynchronous setting of the theme in `changeTheme`
     // can lead to an incorrect toggle on the currently used theme.
-    let currentTheme = manager.theme;
+    let currentTheme: string;
 
     commands.addCommand(CommandIDs.changeTheme, {
       label: args => {
@@ -219,6 +219,7 @@ const themes: JupyterLabPlugin<IThemeManager> = {
         const category = 'Settings';
         const command = CommandIDs.changeTheme;
         const isPalette = true;
+        currentTheme = manager.theme;
 
         manager.themes.forEach(theme => {
           palette.addItem({ command, args: { isPalette, theme }, category });