zyratlo commented on code in PR #7601:
URL: https://github.com/apache/texera/pull/7601#discussion_r3778142127


##########
frontend/src/app/workspace/component/workspace.component.ts:
##########
@@ -259,9 +259,17 @@ export class WorkspaceComponent implements AfterViewInit, 
OnInit, OnDestroy {
           this.workflowActionService.setNewSharedModel(wid, 
this.userService.getCurrentUser());
           // remember URL fragment
           const fragment = this.route.snapshot.fragment;
-          // load the fetched workflow
-          this.workflowActionService.reloadWorkflow(workflow);
+          // A freshly AI-generated workflow arrives with autolayout=1: there 
was no canvas on the
+          // dashboard to lay the operators out on, so render synchronously 
(asyncRendering = false)
+          // so the operators exist in the graph, then tidy the layout once.
+          const shouldAutoLayout = this.route.snapshot.queryParams.autolayout 
=== "1";
+          // load the fetched workflow (asyncRendering = false for autolayout 
so the operators
+          // exist synchronously before the layout runs; undefined otherwise 
uses the config default)
+          this.workflowActionService.reloadWorkflow(workflow, shouldAutoLayout 
? false : undefined);
           this.workflowActionService.enableWorkflowModification();
+          if (shouldAutoLayout) {
+            this.workflowActionService.autoLayoutWorkflow();
+          }

Review Comment:
   fixed in 
[3cfee80](https://github.com/apache/texera/pull/7601/commits/3cfee80ca1165570eeae6e5ab45a9614a11f0acd)



-- 
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]

Reply via email to