Browse Source

[editor] Fix timing issue with import where duplicate insert statements are executed

Johan Åhlén 3 years ago
parent
commit
61b5efed77

+ 4 - 1
desktop/core/src/desktop/js/apps/notebook/snippet.js

@@ -1035,7 +1035,10 @@ class Snippet {
         const previousHash = self.result.handle().previous_statement_hash;
         self.executeNextTimeout = setTimeout(() => {
           // Don't execute if the handle has changed during the timeout
-          if (previousHash === self.result.handle().previous_statement_hash) {
+          if (
+            self.status() !== 'running' &&
+            previousHash === self.result.handle().previous_statement_hash
+          ) {
             self.execute(true); // Execute next, need to wait as we disabled fast click
           }
         }, 1000);

+ 1 - 2
desktop/core/src/desktop/js/ko/components/ko.historyPanel.js

@@ -301,8 +301,7 @@ class HistoryPanel {
                 }
                 notebook.close(); // TODO: Don't close when onSuccessUrl is editor?
               } else {
-                // Perform last DROP statement execute
-                snippet.execute();
+                snippet.execute(true);
               }
             }
           });