Skip to content

Add workflowTriggerAction environment hook for button workflow triggers#6684

Merged
facumenzella merged 1 commit into
mainfrom
facu/workflow-trigger-action
Apr 24, 2026
Merged

Add workflowTriggerAction environment hook for button workflow triggers#6684
facumenzella merged 1 commit into
mainfrom
facu/workflow-trigger-action

Conversation

@facumenzella

@facumenzella facumenzella commented Apr 23, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds \.workflowTriggerAction: ((String) -> Void)? SwiftUI environment value (default nil)
  • ButtonComponentView.performAction() early-exits into the callback when the button has an id and the environment value is set — otherwise falls through to existing action handling unchanged

When WorkflowPaywallView (PR 4b) is on screen, it will inject this callback to forward the component ID to WorkflowNavigator.triggerAction(componentId:). Nothing sets the value yet, so there are zero regressions in non-workflow paywalls.

Follows the same pattern as \.componentInteractionLogger already used in ButtonComponentView.

Depends on: #6679 (PaywallButtonComponent.id), #6680 (WorkflowNavigator) — both merged.
Next: PR 4b (WorkflowPaywallView core).

Test plan

  • swift build passes (verified locally)
  • Existing button action tests unaffected — the early-exit only fires when both viewModel.id != nil and workflowTriggerAction != nil, neither of which is true in existing tests

🤖 Generated with Claude Code


Note

Low Risk
Low risk: behavior only changes when workflowTriggerAction is injected and the button has a component id; otherwise existing button actions run unchanged. Main risk is unintended early-consumption of button taps in workflow paywalls if the injected callback returns true incorrectly.

Overview
Adds a new SwiftUI environment value, \.workflowTriggerAction, to let workflow paywalls intercept button taps by component id.

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.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@facumenzella facumenzella force-pushed the facu/workflow-trigger-action branch from fa3708a to 831de6f Compare April 23, 2026 15:08
@facumenzella facumenzella merged commit 6d7eebe into main Apr 24, 2026
15 of 17 checks passed
@facumenzella facumenzella deleted the facu/workflow-trigger-action branch April 24, 2026 07:43
This was referenced Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants