Skip to content

[Fix-18448][UI] Add null-check for workflowDefinition in dag component computed properties - #18455

Closed
KaiSong-UK wants to merge 1 commit into
apache:devfrom
KaiSong-UK:fix-18448-workflow-definition-null-check
Closed

[Fix-18448][UI] Add null-check for workflowDefinition in dag component computed properties#18455
KaiSong-UK wants to merge 1 commit into
apache:devfrom
KaiSong-UK:fix-18448-workflow-definition-null-check

Conversation

@KaiSong-UK

Copy link
Copy Markdown

Purpose

Fixes #18448

When the DAG component renders, the \startDisplay\ and \menuDisplay\ computed properties throw \TypeError: Cannot read properties of undefined (reading 'releaseState')\ because \workflowDefinition\ can be \undefined\ on the \props.definition\ object.

Root Cause

In \dag/index.tsx, \startDisplay\ and \menuDisplay\ use:
\\ s
props.definition!.workflowDefinition.releaseState
\\

The non-null assertion operator (!) has no runtime effect. When \props.definition.workflowDefinition\ is \undefined, accessing .releaseState\ throws \TypeError.

Changes

Replace non-null assertions with optional chaining (?.) for safe property access:

\\diff

  • props.definition!.workflowDefinition.releaseState === 'ONLINE'
  • props.definition?.workflowDefinition?.releaseState === 'ONLINE'
    \\

\\diff

  • props.definition!.workflowDefinition.releaseState === 'OFFLINE'
  • props.definition?.workflowDefinition?.releaseState === 'OFFLINE'
    \\

This matches the pattern already used in \dag-toolbar.tsx\ (\props.definition?.workflowDefinition?.releaseState).

…t startDisplay and menuDisplay computed properties

Closes apache#18448

In dag/index.tsx, startDisplay and menuDisplay computed properties use the non-null assertion operator (props.definition!) which has no runtime effect. When props.definition.workflowDefinition is undefined, accessing .releaseState throws TypeError. This fix replaces the non-null assertion with optional chaining (?.) to safely handle the case where workflowDefinition is undefined, matching the existing pattern used in dag-toolbar.tsx.
@KaiSong-UK
KaiSong-UK requested a review from SbloodyS as a code owner July 31, 2026 01:17
@github-actions github-actions Bot added the UI ui and front end related label Jul 31, 2026
@SbloodyS SbloodyS closed this Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

UI ui and front end related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] [UI] Clicking edit on a task throws "Cannot read properties of undefined (reading 'releaseState')" when workflowDefinition is undefined

2 participants