Add workflowTriggerAction environment hook for button workflow triggers#6684
Merged
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fa3708a to
831de6f
Compare
vegaro
approved these changes
Apr 23, 2026
This was referenced Apr 24, 2026
This was referenced Apr 30, 2026
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
\.workflowTriggerAction: ((String) -> Void)?SwiftUI environment value (defaultnil)ButtonComponentView.performAction()early-exits into the callback when the button has anidand the environment value is set — otherwise falls through to existing action handling unchangedWhen
WorkflowPaywallView(PR 4b) is on screen, it will inject this callback to forward the component ID toWorkflowNavigator.triggerAction(componentId:). Nothing sets the value yet, so there are zero regressions in non-workflow paywalls.Follows the same pattern as
\.componentInteractionLoggeralready used inButtonComponentView.Depends on: #6679 (PaywallButtonComponent.id), #6680 (WorkflowNavigator) — both merged.
Next: PR 4b (WorkflowPaywallView core).
Test plan
swift buildpasses (verified locally)viewModel.id != nilandworkflowTriggerAction != nil, neither of which is true in existing tests🤖 Generated with Claude Code
Note
Low Risk
Low risk: behavior only changes when
workflowTriggerActionis injected and the button has a componentid; otherwise existing button actions run unchanged. Main risk is unintended early-consumption of button taps in workflow paywalls if the injected callback returnstrueincorrectly.Overview
Adds a new SwiftUI environment value,
\.workflowTriggerAction, to let workflow paywalls intercept button taps by componentid.Updates
ButtonComponentView.performAction()to first call this hook and early-exit (while still logging the interaction) when the workflow consumes the trigger; otherwise it falls through to the existing button action switch.Reviewed by Cursor Bugbot for commit 831de6f. Bugbot is set up for automated code reviews on this repo. Configure here.