yangzhang75 commented on code in PR #8839:
URL: https://github.com/apache/texera/pull/8839#discussion_r4201377393
##########
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 695e659c. The task the search was made for now
travels with it, and an answer whose task is no longer the one on show is
dropped: switchMap only drops a search the next search replaces, and a task
change is not a search, so its answer could still arrive and refill the list
the task change had just cleared. A test flushes a search after the task has
moved on and asserts the shown list is untouched; deletion-checked.
--
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]