Skip to content

Commit

Permalink
fix regression introduced in finos#1693
Browse files Browse the repository at this point in the history
  • Loading branch information
Gayathri committed Jan 10, 2023
1 parent e541585 commit a6029a6
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .changeset/strong-papayas-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
'@finos/legend-application-studio': patch
'@finos/legend-graph': patch
---
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,10 @@ export class EditorGraphState {
}
}
yield flowResult(
this.editorStore.setGraphEditMode(GRAPH_EDITOR_MODE.GRAMMAR_TEXT),
this.editorStore.setGraphEditMode(
GRAPH_EDITOR_MODE.GRAMMAR_TEXT,
entities,
),
);
yield flowResult(
this.globalCompileInTextMode({
Expand Down
16 changes: 11 additions & 5 deletions packages/legend-application-studio/src/stores/EditorStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,17 +340,23 @@ export class EditorStore implements CommandRegistrar {
this.mode = val;
}

*setGraphEditMode(graphEditor: GRAPH_EDITOR_MODE): GeneratorFn<void> {
*setGraphEditMode(
graphEditor: GRAPH_EDITOR_MODE,
entities?: Entity[],
): GeneratorFn<void> {
this.graphEditMode = graphEditor;
this.changeLocalChangesState();
this.graphState.clearProblems();
if (graphEditor === GRAPH_EDITOR_MODE.GRAMMAR_TEXT) {
// Stop change detection as we don't need the actual change detection in text mode
this.changeDetectionState.stop();
this.changeDetectionState.computeLocalChangesInTextMode(
(yield this.graphManagerState.graphManager.pureCodeToEntities(
this.grammarTextEditorState.graphGrammarText,
)) as Entity[],
yield flowResult(
this.changeDetectionState.computeLocalChangesInTextMode(
entities ??
this.graphManagerState.graphManager.graphToEntities(
this.graphManagerState.graph,
),
),
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -822,9 +822,11 @@ export class TextLocalChangesState extends LocalChangesState {
}

*restartChangeDetection(): GeneratorFn<void> {
this.editorStore.changeDetectionState.computeLocalChangesInTextMode(
this.editorStore.changeDetectionState.workspaceLocalLatestRevisionState
.entities,
);
yield Promise.all([
this.editorStore.changeDetectionState.computeLocalChangesInTextMode(
this.editorStore.changeDetectionState.workspaceLocalLatestRevisionState
.entities,
),
]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ export abstract class AbstractPureGraphManager {
abstract getExampleExternalFormatImportText(): string;
abstract entitiesToPureProtocolText(entities: Entity[]): Promise<string>;
abstract pureProtocolTextToEntities(protocol: string): Entity[];
abstract graphToEntities(graph: PureModel): Entity[];

// ------------------------------------------- Execute -------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2014,6 +2014,11 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
return this.pureModelContextDataToEntities(graphData);
};

graphToEntities(graph: PureModel): Entity[] {
const graphData = this.graphToPureModelContextData(graph);
return this.pureModelContextDataToEntities(graphData);
}

// --------------------------------------------- Execution ---------------------------------------------

private createExecutionInput = (
Expand Down

0 comments on commit a6029a6

Please sign in to comment.