fix(web): allow workflow graph view to load without a codebase (#958)

The useQuery for workflow definitions required both workflowName and
codebaseCwd to be truthy. For CLI-triggered runs or "No project" web
runs where codebase_id is null, codebaseCwd stays undefined and the
query never fires — showing "Loading graph..." forever. The server
already handles missing cwd by falling back to bundled defaults, so
the client gate only needs workflowName.

Fixes #958

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cole Medin 2026-04-07 16:20:45 -05:00
parent 018e8b909e
commit a09d198a8e

View file

@ -235,12 +235,12 @@ export function WorkflowExecution({ runId }: WorkflowExecutionProps): React.Reac
}, [codebaseId]);
// Fetch workflow definition for DAG topology (depends_on edges).
// Enabled whenever we have a workflow name and cwd — isDag is derived from the result,
// not used as a gate, to avoid a circular dependency.
// Only gated on workflowName — codebaseCwd is optional; the server falls back to bundled
// defaults when cwd is absent (handles CLI runs and "No project" web runs).
const { data: workflowDef } = useQuery({
queryKey: ['workflowDefinition', initialData?.workflowName, codebaseCwd],
queryFn: () => getWorkflow(initialData?.workflowName ?? '', codebaseCwd ?? undefined),
enabled: !!initialData?.workflowName && !!codebaseCwd,
enabled: !!initialData?.workflowName,
staleTime: Infinity,
});
const dagDefinitionNodes = workflowDef?.workflow?.nodes ?? null;