-
Notifications
You must be signed in to change notification settings - Fork 129
fix: prevent 'No Workers Running' flash during workflow load #3131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add workersLoaded flag to distinguish between "loading workers" and "loaded with no workers" states. This fixes a race condition where the warning would briefly appear before worker data finished loading. The warning now only shows when workers have been definitively loaded and found to be empty, not during the initial loading phase.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| @@ -97,7 +97,7 @@ | |||
| const { taskQueue } = workflow; | |||
| const workers = await getPollers({ queue: taskQueue, namespace }); | |||
|
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚠️ Type 'WorkflowExecution | undefined' is not assignable to type 'WorkflowExecution | null'.
| $workflowRun = { ...$workflowRun, workflow, workers, workersLoaded: true }; | ||
|
|
||
| workflowRunController = new AbortController(); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚠️ 'workflow' is possibly 'undefined'.
| export const initialWorkflowRun: WorkflowRunWithWorkers = { | ||
| workflow: null, | ||
| workers: { pollers: [], taskQueueStatus: null }, | ||
| workersLoaded: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚠️ Type 'undefined' is not assignable to type 'WorkflowMetadata'.
|
| const workers = await getPollers({ queue: taskQueue, namespace }); | ||
|
|
||
| $workflowRun = { ...$workflowRun, workflow, workers }; | ||
| $workflowRun = { ...$workflowRun, workflow, workers, workersLoaded: true }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we ever set this back to false onDestroy/navigate away from workflow page?
Summary
Fixes a race condition where the "No Workers Running" warning would briefly flash when opening a workflow, even when workers were actively running.
Root cause: The
workflow-call-stack-errorcomponent checked!workers?.pollers?.lengthto show the warning, but the initial store state haspollers: []. When a workflow loaded, the warning would briefly appear before worker data finished loading.Fix: Added a
workersLoadedflag to the store to distinguish between:workersLoaded: false,pollers: [])workersLoaded: true,pollers: [])The warning now only shows in the second case.
Changes
src/lib/stores/workflow-run.ts- AddedworkersLoaded: booleanto store typesrc/lib/layouts/workflow-run-layout.svelte- SetsworkersLoaded: trueafter fetchingsrc/lib/components/workflow/workflow-call-stack-error.svelte- ChecksworkersLoadedbefore showing warningTest plan