Make resolver workflow model selection survive analysis timing

Queue workflow model reference selection requests in the dialog, wait for
workflow analysis to complete before attempting selection, and handle
superseded or timed-out requests gracefully.

- Track pending selection requests on the dialog with status fields
- Apply queued selections from lifecycle graph methods after analysis
- Await loadWorkflowData/loadLoadedModels so the caller can proceed
  after tab content is actually ready
- Add timeout handling with user-visible warnings when selection cannot
  complete
- Cover queueing, superseding, waiting, and completion in JS tests
This commit is contained in:
Dariusz L
2026-07-24 16:00:10 +02:00
parent d368a6dffc
commit 668cecea2d
6 changed files with 138 additions and 21 deletions
@@ -157,9 +157,10 @@ export const lifecycleGraphMethods = {
if (shouldRenderMissingModels()) {
await this.ensureDownloadDirectoriesLoaded();
this.displayMissingModels(this.contentElement, this.cachedAnalysisData);
this.applyPendingWorkflowModelSelection?.(this.cachedAnalysisData);
this.reconnectActiveDownloads();
}
return;
return this.cachedAnalysisData;
}
if (!this.workflowHasNodes(workflow)) {
@@ -179,8 +180,9 @@ export const lifecycleGraphMethods = {
if (shouldRenderMissingModels()) {
await this.ensureDownloadDirectoriesLoaded();
this.displayMissingModels(this.contentElement, data);
this.applyPendingWorkflowModelSelection?.(data);
}
return;
return data;
}
const analysisId = `an-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
@@ -217,10 +219,12 @@ export const lifecycleGraphMethods = {
if (shouldRenderMissingModels()) {
await this.ensureDownloadDirectoriesLoaded();
this.displayMissingModels(this.contentElement, data);
this.applyPendingWorkflowModelSelection?.(data);
// Reconnect any active downloads to their new progress divs
this.reconnectActiveDownloads();
}
return data;
} catch (error) {
if (!loadToken || this._workflowDataLoadToken === loadToken) {
@@ -232,6 +236,7 @@ export const lifecycleGraphMethods = {
} else if (!loadToken && this.activeTab === 'missing' && this.contentElement) {
this.contentElement.innerHTML = `<p class="mr-error-text">Error: ${error.message}</p>`;
}
return null;
}
},