Copilot commented on code in PR #8839:
URL: https://github.com/apache/texera/pull/8839#discussion_r4305492067


##########
frontend/src/app/workspace/component/workflow-form/workflow-form.component.ts:
##########
@@ -543,6 +543,23 @@ export class WorkflowFormComponent implements OnInit, 
OnDestroy {
    */
   @HostListener("focusout")
   public onFocusOut(): void {
+    this.flushHeldRebuild();
+  }
+
+  /**
+   * A click or a key inside the page also ends a hold, because a focus change 
is not the only thing
+   * that does: closing an nz-select leaves the focus in its search box 
(ng-zorro re-focuses it), so
+   * no focusout fires, and a rebuild held while the list was open would have 
waited for an unrelated
+   * event (Copilot on #8839). The same later() re-check as below decides it 
after the current tick,
+   * by when the dropdown has lost its open class.
+   */
+  @HostListener("click")
+  @HostListener("keyup")
+  public onInteraction(): void {
+    this.flushHeldRebuild();

Review Comment:
   When a rebuild is held while an nz-select is open, accepting an option with 
Enter emits a form change and closes the dropdown. This keyup handler schedules 
the rebuild at 0 ms, before the 150 ms write-back debounce completes. 
`readConfig()` calls `buildForm()`, whose `formsRebuilt` emission cancels the 
pending write through `takeUntil`, so the selection is discarded and the old 
operator value returns. Flush pending card patches before reading the graph and 
rebuilding, or wait for those writes to complete. Add a regression test that 
commits a selection while a rebuild is held.



##########
frontend/src/app/workspace/component/hugging-face/hugging-face.component.ts:
##########
@@ -517,10 +563,15 @@ export class HuggingFaceComponent extends 
FieldType<FieldTypeConfig> implements
   }
 
   clearSearch(): void {
+    this.resetSearch();
+    this.goToPage(0);
+  }
+
+  /** Forget the search: the text, the results it filtered to, and the spinner 
it was waiting on. */
+  private resetSearch(): void {
     this.searchText = "";
     this.filteredModels = null;
     this.searchLoading = false;

Review Comment:
   This reset leaves queries queued in `debounceTime(300)` alive. If a 
model-driven task change arrives before the debounce expires, 
`setupServerSearch()` later captures the new task for the old query. The 
response passes the task guard and filters the new task's models even though 
the search box is empty. Cancel and recreate the search subscription on reset 
to discard both queued queries and active requests. Add a test that changes the 
task before the debounce expires, and update existing late-response tests to 
expect cancellation.



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