Skip to content

Commit b37ca09

Browse files
ELin2025Copilot
andcommitted
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Elliot Lin <36275109+ELin2025@users.noreply.github.com>
1 parent 6db846b commit b37ca09

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

frontend/src/app/workspace/component/hugging-face/hugging-face.component.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,17 +223,25 @@ export class HuggingFaceComponent extends FieldType<FieldTypeConfig> implements
223223
// Another component instance already has a fetch in flight — wait for it
224224
if (tasksFetchSubscription !== null) {
225225
this.tasksLoading = true;
226-
// Poll for completion (the module-level cache will be set when done)
227-
this.taskPollInterval = setInterval(() => {
226+
if (this.taskPollInterval !== null) clearInterval(this.taskPollInterval);
227+
const poll = setInterval(() => {
228228
if (cachedTaskOptions !== null || tasksFetchError !== null) {
229-
clearInterval(this.taskPollInterval!);
229+
clearInterval(poll);
230230
this.taskPollInterval = null;
231231
this.tasksLoading = false;
232232
this.taskOptions = cachedTaskOptions ?? STATIC_TASK_OPTIONS;
233233
if (tasksFetchError) this.tasksError = tasksFetchError;
234234
this.cdr.detectChanges();
235+
} else if (tasksFetchSubscription === null) {
236+
// Fetch was canceled before populating caches; stop polling and fall back.
237+
clearInterval(poll);
238+
this.taskPollInterval = null;
239+
this.tasksLoading = false;
240+
this.taskOptions = STATIC_TASK_OPTIONS;
241+
this.cdr.detectChanges();
235242
}
236243
}, 200);
244+
this.taskPollInterval = poll;
237245
return;
238246
}
239247

0 commit comments

Comments
 (0)