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


##########
frontend/src/app/workspace/component/hugging-face/hugging-face.component.ts:
##########
@@ -200,6 +203,25 @@ export class HuggingFaceComponent extends 
FieldType<FieldTypeConfig> implements
     );
   }
 
+  /**
+   * The task can change under this widget: a co-editor's edit, or the Form 
View's, lands on the
+   * operator and from there on this field's model (the panel hands formly a 
fresh model object; the
+   * form card is rebuilt). The selector shows this widget's own state, and on 
the panel the schema's
+   * `task` field is hidden, so there is no control to listen to: the model is 
checked on every
+   * change detection instead, and the selector follows it as a local pick is 
followed -- show the
+   * task, load its models -- rather than keeping what it showed when it was 
built.
+   */
+  ngDoCheck(): void {
+    const tag = this.model?.task;
+    if (!this.initialized || typeof tag !== "string" || !tag || tag === 
this.selectedTaskTag) {
+      return;
+    }
+    this.selectedTaskTag = tag;
+    this.searchText = "";
+    this.filteredModels = null;
+    this.loadAllModels();

Review Comment:
   Confirmed and fixed in 29cec391. Anything that comes back for a task the 
widget has since left is cached for the next asker and not shown -- the 
response, the failure, and a poll waiting on another instance's request, which 
is now stopped at the top of the next load whichever path that load takes. 
Three tests cover it, each deletion-checked. The race predates this PR (picking 
a second task while the first loads does it on main); this PR adds the no-click 
trigger, so the guard belongs with it.



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