nanxiuzi opened a new pull request, #18449: URL: https://github.com/apache/dolphinscheduler/pull/18449
## Summary Fixes #18448 `dag/index.tsx` has two computed properties (`startDisplay` and `menuDisplay`) that access `props.definition.workflowDefinition.releaseState` without null-checking `workflowDefinition`. When `workflowDefinition` is `undefined` (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 throws `TypeError: Cannot read properties of undefined (reading 'releaseState')` and breaks the DAG editor page. ## Changes - `dolphinscheduler-ui/src/views/projects/workflow/components/dag/index.tsx`: replace `props.definition!.workflowDefinition.releaseState` with `props.definition?.workflowDefinition?.releaseState` in two computed properties (`startDisplay` at line 130, `menuDisplay` at line 152). This matches the safe pattern already used in `dag-toolbar.tsx` (lines 276 and 512): `props.definition?.workflowDefinition?.releaseState`. No behavior change when `workflowDefinition` is defined — only the previously-crashing case now returns `false` (the same value the `else` branches already return). ## Verification - `pnpm run build:prod` passes (vue-tsc type check + Vite production build). - Manual test on a 3.4.2 deployment: previously, clicking "Edit" on a task in the affected state produced `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 when `workflowDefinition` is `undefined`, which is the correct behavior since the user cannot meaningfully start/operate on a workflow that has no `workflowDefinition`. ## Reproduce steps (for reviewers) 1. Open a workflow definition in a state where `props.definition.workflowDefinition` is `undefined` (e.g., draft, or workflow definition just deleted but task instances still referencing it). 2. Right-click a task node → "Edit". 3. Without this PR: browser console shows `Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'releaseState')` and the DAG page stops rendering. 4. With this PR: the page renders normally; the start button and "other" menu are hidden in the right-click menu (since `workflowDefinition` is `undefined`). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
