mengw15 commented on code in PR #8581:
URL: https://github.com/apache/texera/pull/8581#discussion_r4052724715
##########
frontend/src/app/workspace/component/workflow-editor/workflow-editor.component.ts:
##########
@@ -205,8 +205,14 @@ export class WorkflowEditorComponent implements OnInit,
AfterViewInit, OnDestroy
}
ngAfterViewInit() {
- this.editor = document.getElementById("workflow-editor")!;
- this.editorWrapper = document.getElementById("workflow-editor-wrapper")!;
+ // This component's own elements, not whichever the document happens to
hold first. Two of
+ // these editors are briefly in the page at once when the two views of a
workflow hand over:
+ // the arriving one initialises while the departing one is still being
removed. Searching the
+ // document returned the departing view's container, so the paper was
built into a div about
+ // to disappear and the arriving canvas stayed blank, with nothing to pan
and nothing to click.
+ const host = this.elementRef.nativeElement as HTMLElement;
+ this.editor = host.querySelector("#workflow-editor")!;
Review Comment:
`MiniMapComponent` has the same three lookups and is in both views, so the
overlap this PR creates reaches it too: `document.getElementById("mini-map")`,
`#mini-map-navigator`, and — the same id this commit is about —
`document.getElementById("workflow-editor")`
(mini-map.component.ts:62,105,106), while the Form View renders
`<texera-mini-map>` beside its editor. The description leaves the mini-map's
lookups to #8606 as ones "this PR does not need", but the reason this one
needed fixing (two of these are briefly in the page at once) applies there
unchanged: the arriving mini-map can resolve the departing view's container,
and its navigator can be sized against the departing view's editor. Worth
carrying the same host-scoped fix, or saying why the mini-map is not exposed to
the same tick.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]