yangzhang75 commented on code in PR #8839:
URL: https://github.com/apache/texera/pull/8839#discussion_r4222506220
##########
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:
Right, fixed in c02ba6e5. A task change now forgets the search altogether --
the text, the results and the spinner -- through one resetSearch() that
clearSearch() also uses, instead of clearing two of the three. The dropped
answer was the only thing that would have turned the spinner off, so leaving it
set made the widget read as searching for an empty string. A test asserts
isSearching is false after the task change and stays false when the old answer
lands; 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]