feat(workflow): advance record state from the lifecycle diagram#66
Merged
Conversation
Make the state machine interactive. Under the Lifecycle diagram, the current
state's outgoing transitions render as "Available Actions" buttons; tapping one
confirms, then PATCHes the record's state field to the target and refreshes —
the diagram re-highlights and the action set updates for the new state.
- RecordStateMachines gains `onTransition` + `pendingEvent`; it lists only the
current state's transitions as buttons (labelled "<event desc> → <target
state>"), disabling them while one is applying.
- The record detail screen wires the handler: confirm (Alert) → client.data
.update({ [field]: target }) → refetch, with success/error toasts.
- i18n: adds a `workflow` bundle (availableActions, updateStatus, moveToConfirm,
statusUpdated, statusUpdateFailed) in en / zh / ar.
Verified in-browser against a local 7.5.0 server: advancing crm_opportunity
proposal → negotiation re-highlights the diagram and swaps the available
actions to the negotiation transitions (Deal won / Lost in negotiation). Adds
RecordStateMachines tests; typecheck clean; suite green apart from pre-existing
snapshots.
Note: the confirm uses Alert.alert (matching the existing Delete action), which
is native-only — on RN-Web the confirm step is a no-op.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
Makes the state machine interactive. Under the Lifecycle diagram on record detail, the current state's outgoing transitions render as Available Actions buttons; tapping one confirms, PATCHes the record's state field to the target, and refreshes — the diagram re-highlights and the action set updates for the new state.
RecordStateMachinesgainsonTransition+pendingEvent. It lists only the current state's transitions as buttons (labelled"<event description> → <target state>"), disabling them while one applies.Alert) →client.data.update({ [field]: target })→ refetch, with success/error toasts.workflowbundle (availableActions,updateStatus,moveToConfirm,statusUpdated,statusUpdateFailed) in en / zh / ar.Verification
crm_opportunityproposal → negotiation re-highlights the diagram (谈判 becomes current) and swaps Available Actions to the negotiation transitions (Deal won → 成交 / Lost in negotiation → 失败). The underlyingPATCH /data/...returns 200 and persists.RecordStateMachinestests (current-state-only buttons, firesonTransition, read-only when omitted, empty when no machines);tscclean; full suite 1128 pass (20 pre-existing snapshot failures, unrelated).Note
The confirm step uses
Alert.alert(consistent with the existing Delete action), which is native-only — on RN-Web the confirm is a no-op, so the data path was verified directly in the browser while the button → handler wiring is covered by tests + native behavior. Could move to the cross-platformDialogcomponent in a follow-up if web parity is wanted.🤖 Generated with Claude Code