Skip to content

feat: extend useTestDetails with previewAction#1654

Closed
ogp-weeloong wants to merge 3 commits into
graphite-base/1654from
claude/email-preview-button
Closed

feat: extend useTestDetails with previewAction#1654
ogp-weeloong wants to merge 3 commits into
graphite-base/1654from
claude/email-preview-button

Conversation

@ogp-weeloong
Copy link
Copy Markdown
Contributor

feat: extend useTestDetails with previewAction

useTestDetails now accepts substeps and returns previewAction:
{ kind, fieldKey, html } | null. The hook scans the step's substep
arguments for an IFieldRichText with a previewType marker, reads its
live form value via useWatch, and emits a previewAction when the live
value is a non-empty string. To respect the rules-of-hooks, useWatch
is always called with a stable dummy name when no previewable field
exists.

Pass substeps from FlowStepTestController so the call site stays
typed; consumption of previewAction lands in the next commit.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

feat: render Preview email button in FlowStepTestController

Consumes previewAction from useTestDetails and renders a kind-specific
preview button next to both Check-step entry points (the bottom Check
step button and, after a test run succeeds, the Check step again
button). Clicking it pipes the live form value through
substituteForPreview and opens the corresponding modal (today,
EmailPreviewModal).

Copy is driven by a PREVIEW_BUTTON_COPY map keyed by TFieldPreviewType
so future preview kinds plug in without touching the controller. The
controller has no references to specific apps, step keys, or field
names.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

feat: opt Postman body field into email preview

Sets previewType: 'email' on the rich-text body field in
transactionalEmailFields. End-to-end, this makes the "Preview email"
button appear next to "Check step" for the Send transactional email
action; clicking it renders the current draft body through
@emailens/engine.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

ogp-weeloong and others added 3 commits May 26, 2026 00:30
useTestDetails now accepts substeps and returns previewAction:
{ kind, fieldKey, html } | null. The hook scans the step's substep
arguments for an IFieldRichText with a previewType marker, reads its
live form value via useWatch, and emits a previewAction when the live
value is a non-empty string. To respect the rules-of-hooks, useWatch
is always called with a stable dummy name when no previewable field
exists.

Pass substeps from FlowStepTestController so the call site stays
typed; consumption of previewAction lands in the next commit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Consumes previewAction from useTestDetails and renders a kind-specific
preview button next to both Check-step entry points (the bottom Check
step button and, after a test run succeeds, the Check step again
button). Clicking it pipes the live form value through
substituteForPreview and opens the corresponding modal (today,
EmailPreviewModal).

Copy is driven by a PREVIEW_BUTTON_COPY map keyed by TFieldPreviewType
so future preview kinds plug in without touching the controller. The
controller has no references to specific apps, step keys, or field
names.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sets previewType: 'email' on the rich-text body field in
transactionalEmailFields. End-to-end, this makes the "Preview email"
button appear next to "Check step" for the Send transactional email
action; clicking it renders the current draft body through
@emailens/engine.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor Author

ogp-weeloong commented May 28, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add the label lfg to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant