yangzhang75 commented on code in PR #8845:
URL: https://github.com/apache/texera/pull/8845#discussion_r4199613944


##########
frontend/src/app/workspace/component/workflow-form/workflow-form.component.ts:
##########
@@ -838,24 +858,115 @@ export class WorkflowFormComponent implements OnInit, 
OnDestroy {
    * exposed property. Each input gets its own form keyed by binding id.
    */
   private buildForm(): void {
+    // A rebuild ends every card's write-back subscription, so an edit whose 
debounced write has not
+    // fired yet is written now, and the rebuilt card is seeded with it rather 
than without it.
+    this.rendered.forEach(card => card.pendingWrite && card.flushWrite?.());
     this.formsRebuilt.next();
     this.rendered = this.visibleFields
       .map(field => this.renderField(field))
       .filter((r): r is RenderedField => r !== undefined);
   }
 
+  /**
+   * A compilation result rebuilds the cards only when it changed something 
they show: a card's
+   * operator schema (the column enums compilation writes into it, which turn 
an attribute box into a
+   * dropdown), the set of inputs (an operator deleted on the canvas makes its 
card broken), or an
+   * operator value a card does not hold (a co-editor's edit; the card's own 
edit, written back or
+   * still on its way, is not that). Most compilations change none of these -- 
the one a card's own
+   * write triggers, for one -- and used to rebuild every card regardless: the 
controls were redrawn
+   * under the reader's eyes, the focus went with them, and a click made in 
the last moments before
+   * the rebuild was lost, since the rebuild cancelled that card's pending 
write. The canvas's
+   * property panel redraws only for a schema change; the form does the same. 
The result picker and
+   * the shown results still follow the graph either way.
+   */
+  private onCompilationChanged(): void {
+    if (this.cardsNeedRebuild()) {
+      this.rebuildFormOrDefer(false);

Review Comment:
   Good catch, and fixed in e051ba76 -- the first fix did reintroduce exactly 
the churn this PR is about. Every property an input is bound to is now left out 
of the context, this card's own and any other card's on the same step, since 
each of them is compared against the card that shows it. A step with two 
exposed inputs no longer rebuilds either card when one is edited (a test 
asserts both card objects survive it), while a sibling no card is bound to -- 
the widget context proper -- still rebuilds. Four deletion checks cover the 
rule, including one that leaves out only the card's own property.



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