Copilot commented on code in PR #8839:
URL: https://github.com/apache/texera/pull/8839#discussion_r4199412951
##########
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:
A task change clears the displayed search state but does not cancel an
in-flight server-side search. `setupServerSearch()` captures the old task in
its request and applies every eventual response unconditionally, so a search
for task A can return after this switches to task B and replace B's models with
A's results. Cancel/retag pending searches when the task changes and ignore
responses whose captured task no longer matches `selectedTaskTag`.
--
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]