浏览代码

[editor] Prevent replacing variables with values in historic entries

Johan Ahlen 4 年之前
父节点
当前提交
94165f370f

+ 1 - 2
desktop/core/src/desktop/js/apps/editor/execution/executable.ts

@@ -429,10 +429,9 @@ export default abstract class Executable {
   async toContext(id?: string): Promise<ExecutableContext> {
     const session = await sessionManager.getSession({ type: this.executor.connector().id });
     if (this.executor.snippet) {
-      this.executor.snippet.statement_raw(this.getStatement());
       return {
         operationId: this.operationId,
-        snippet: this.executor.snippet.toContextJson(),
+        snippet: this.executor.snippet.toContextJson(this.getStatement()),
         notebook: JSON.stringify(await this.executor.snippet.parentNotebook.toJs())
       };
     }

+ 2 - 2
desktop/core/src/desktop/js/apps/editor/snippet.js

@@ -1091,7 +1091,7 @@ export default class Snippet {
     this.showLongOperationWarning(false);
   }
 
-  toContextJson() {
+  toContextJson(statement) {
     return JSON.stringify({
       id: this.id(),
       type: this.dialect(),
@@ -1099,7 +1099,7 @@ export default class Snippet {
       defaultLimit: this.defaultLimit(),
       status: this.status(),
       statementType: this.statementType(),
-      statement: this.statement(),
+      statement: statement || this.statement(),
       aceCursorPosition: this.aceCursorPosition(),
       lastExecuted: this.lastExecuted(),
       statementPath: this.statementPath(),