Explorar o código

WIP: Parser: only create new AS version when AS actually changed :)

Joeri Exelmans %!s(int64=2) %!d(string=hai) anos
pai
achega
57a14acb72
Modificáronse 1 ficheiros con 7 adicións e 2 borrados
  1. 7 2
      src/frontend/app.tsx

+ 7 - 2
src/frontend/app.tsx

@@ -412,15 +412,20 @@ export class App extends React.Component<{}, AppState> {
       const {corr: corrComposite, as: asComposite, csOverrides, asOverrides} = this.parser.parse(csComposite,
         this.state.cs.version, this.state.corr.version, this.state.as.version);
 
+
       const newCsVersion = this.state.cs.versionRegistry.createVersion(this.state.cs.version, csComposite);
-      const newAsVersion = this.state.as.versionRegistry.createVersion(this.state.as.version, asComposite);
+      
+      const newAsVersion =  (asComposite.deltas.length > 0) ?
+        this.state.as.versionRegistry.createVersion(this.state.as.version, asComposite)
+        : this.state.as.version; // do not create a new AS version
+
       const newCorrVersion = this.state.corr.versionRegistry.createVersion(this.state.corr.version, corrComposite,
         embed(
           ["cs", newCsVersion, csOverrides],
           ["as", newAsVersion, asOverrides],
         ));
 
-      // This also trigggers a state update:
+      // This also trigggers a few state updates:
       this.state.cs.graphDeltaExecutor.exec(csComposite);
       this.state.corr.graphDeltaExecutor.exec(corrComposite);
       this.state.as.graphDeltaExecutor.exec(asComposite);