[Fix-18448][UI] Guard missing workflow definition in DAG menu - #18542
[Fix-18448][UI] Guard missing workflow definition in DAG menu#18542yongster wants to merge 5 commits into
Conversation
SbloodyS
left a comment
There was a problem hiding this comment.
Guard the missing definition at the data boundary, not only in two menu conditions
The linked issue assumes that props.definition exists while props.definition.workflowDefinition is undefined. The two optional-chain changes prevent the releaseState reads from failing, but the same payload still crashes elsewhere in the DAG path:
workflow/definition/detail/index.tsx:64-67readsres.workflowDefinition.releaseStateand.locations.workflow/instance/detail/index.tsx:61readsres.dagData.workflowDefinition.locations.use-custom-cell-builder.ts:122readsdefinition.workflowDefinition.locationswhile building the graph.dag/index.tsx:374-430mountsVersionModalandStartModalbased only on the outerdefinition, then passes the missing inner object to them.
Therefore, the page may fail before the context-menu computed properties are evaluated, or fail later through another consumer. This patch suppresses one symptom but does not make the stated missing-workflowDefinition state safe.
Please add a regression test using the actual failing API payload, then either reject/handle the invalid response before rendering the DAG or consistently guard every consumer that supports this state. If workflowDefinition is contractually required, the correct fix is at the response/state boundary rather than adding isolated optional chaining.
Was this PR generated or assisted by AI?
YES. AI assisted with code exploration, the null-safety changes, and validation.
Purpose of the pull request
Fixes #18448. Prevent the DAG from receiving an invalid response that lacks
workflowDefinition.Brief change log
dagDataresponse before mounting the instance DAG.Verify this pull request
pnpm exec eslintfor the changed DAG and detail-page files.pnpm run build:prod(vue-tsc --noEmitand production Vite build).Pull Request Notice
Pull Request Notice