[Fix-18448][ui] Fix releaseState undefined access in dag computed properties - #18449
Open
nanxiuzi wants to merge 1 commit into
Open
[Fix-18448][ui] Fix releaseState undefined access in dag computed properties#18449nanxiuzi wants to merge 1 commit into
nanxiuzi wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #18448
dag/index.tsxhas two computed properties (startDisplayandmenuDisplay) that accessprops.definition.workflowDefinition.releaseStatewithout null-checkingworkflowDefinition. WhenworkflowDefinitionisundefined(e.g., the workflow is in a draft state, the definition was deleted but task instances still reference it, or the API response is missing the field), the access throwsTypeError: Cannot read properties of undefined (reading 'releaseState')and breaks the DAG editor page.Changes
dolphinscheduler-ui/src/views/projects/workflow/components/dag/index.tsx: replaceprops.definition!.workflowDefinition.releaseStatewithprops.definition?.workflowDefinition?.releaseStatein two computed properties (startDisplayat line 130,menuDisplayat line 152).This matches the safe pattern already used in
dag-toolbar.tsx(lines 276 and 512):props.definition?.workflowDefinition?.releaseState. No behavior change whenworkflowDefinitionis defined — only the previously-crashing case now returnsfalse(the same value theelsebranches already return).Verification
pnpm run build:prodpasses (vue-tsc type check + Vite production build).Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'releaseState')in the browser console and the page stopped rendering. With this fix, the page renders correctly and the right-click menu items (startDisplay,menuDisplay) are hidden whenworkflowDefinitionisundefined, which is the correct behavior since the user cannot meaningfully start/operate on a workflow that has noworkflowDefinition.Reproduce steps (for reviewers)
props.definition.workflowDefinitionisundefined(e.g., draft, or workflow definition just deleted but task instances still referencing it).Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'releaseState')and the DAG page stops rendering.workflowDefinitionisundefined).