Quellcode durchsuchen

Shorten the logic slightly with optional chaining.

Jason Grout vor 5 Jahren
Ursprung
Commit
9aecd5116f
1 geänderte Dateien mit 1 neuen und 5 gelöschten Zeilen
  1. 1 5
      packages/help-extension/src/index.tsx

+ 1 - 5
packages/help-extension/src/index.tsx

@@ -197,11 +197,7 @@ function activate(
       kernelConnectionOptions: { handleComms: false }
     });
 
-    const kernel = session.kernel;
-    if (!kernel) {
-      return;
-    }
-    void kernel.info.then(kernelInfo => {
+    void session.kernel?.info.then(kernelInfo => {
       const name = session.kernel!.name;
 
       // Check the cache second time so that, if two callbacks get scheduled,