Round-trip the prompt action type through the flow builder - #4481
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (6)
📝 WalkthroughWalkthroughAdds semantic action type persistence and restoration for flow buttons. Plain action changes preserve unrelated action types. The sign-out selector value and label are updated. Transformation and component tests cover the behavior. ChangesButton action type preservation
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
frontend/apps/console/src/features/flows/components/resource-property-panel/extended-properties/ButtonExtendedProperties.tsxESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. frontend/apps/console/src/features/flows/components/resource-property-panel/extended-properties/__tests__/ButtonExtendedProperties.test.tsxESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox. frontend/apps/console/src/features/flows/models/responses.tsESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
| // it from and where serialization projects it back out of. Only when the element does not | ||
| // already carry one: an unwired button keeps its type on the element alone, since a prompt | ||
| // action is only emitted once the button has a nextNode. | ||
| ...(matchingAction.type && component.actionType === undefined ? {actionType: matchingAction.type} : {}), |
There was a problem hiding this comment.
| ...(matchingAction.type && component.actionType === undefined ? {actionType: matchingAction.type} : {}), | |
| ...(matchingAction.type && !component.actionType ? {actionType: matchingAction.type} : {}), |
The selector clears with onChange('actionType', '', resource), and since the component cleaner here doesn't strip actionType, the '' gets persisted into meta.components. The new guard here checks component.actionType === undefined, so a component loaded with actionType: '' blocks the backfill even though the empty string means no type.
The prompt action's type was write-only in the console: serialization emitted prompts[].action.type from the button element's actionType, but the load path never read it back and FlowNodeAction did not even declare the field. A flow definition authored outside the builder therefore lost its action type on the first save, and the Action selector showed the wrong option for it. Restore the type onto the element when a definition is loaded, so the property panel can display it and serialization emits it again. The element wins when it already carries a type, because an unwired button holds the only copy: a prompt action is emitted only once the button has a nextNode. Clear only the type the selector owns when the author picks a plain action. SUBMIT and REJECT are documented prompt action types with no option in the dropdown, and blanket clearing discarded them. Key the Sign out option on SIGN_OUT_CONFIRM rather than a UI-only SIGN_OUT sentinel, so the value selected in the editor and the value in the flow definition are one vocabulary, and label it Sign Out Action to match the Submit Form and Trigger Action options beside it. Refs thunder-id#4299
293335b to
d8972e7
Compare
Purpose
prompts[].action.typeis write-only in the console. Serialization emits it from the button element'sactionType, but the load path never reads it back, andFlowNodeActiondoes not even declare the field. A flow definition authored outside the flow builder therefore loses its action type the first time the flow is saved, and the Action selector shows the wrong option for it in the meantime.That makes a hand-authored sign-out flow silently regress into an endless confirmation loop after an unrelated edit in the builder, and it discards the
SUBMITandREJECTaction types the API documents.Approach
Restore the type on load.
restoreButtonActionalready receives the matching prompt action, so it backfillsactionTypeonto the element, andFlowNodeActionnow declarestype. The element wins when it already carries a type: an unwired button holds the only copy, because a prompt action is emitted only once the button has anextNode.Clear only the type the selector owns. Picking a plain action previously wiped any
actionType, so an action type with no option in the dropdown was discarded on the next save. It is now cleared only when it was the sign-out value.Key the option on the persisted value. The Sign out option used a UI-only
SIGN_OUTsentinel that never left the component, while the flow definition storedSIGN_OUT_CONFIRM. The option is now keyed onPromptActionTypes.SignOutConfirm, so the value selected in the editor and the value in the flow definition are one vocabulary.Align the option label.
Trigger SignoutbecomesSign Out Action, matching theSubmit FormandTrigger Actionoptions beside it.Related Issues
Related PRs
Checklist
breaking changelabel added.Security checks
Summary by CodeRabbit
Bug Fixes
UI Updates
Tests