feat(editor): return non-prettified HTML from composeReactEmail#3538
feat(editor): return non-prettified HTML from composeReactEmail#3538lucasfcosta wants to merge 2 commits into
Conversation
Adds a new `unformattedHtml` field on the `composeReactEmail` result, exposing the output of `render()` before `pretty()` runs. For deeply-nested table-based emails (typical Stripo or Mailchimp exports), Prettier indentation accounts for ~78% of the output bytes, inflating a 55 KB import to ~400 KB and pushing it past Gmail's 102 KB clipping threshold. The compact form is already computed inside the function and was being discarded. Consumers that persist or send the email can now opt into it without touching `html` or `text`, which remain unchanged.
|
@lucasfcosta is attempting to deploy a commit to the resend Team on Vercel. A member of the Team first needs to authorize it. |
🦋 Changeset detectedLatest commit: e7dc25a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
| }); | ||
|
|
||
| describe('unformattedHtml', () => { | ||
| it('returns the pre-pretty render() output alongside html and text', async () => { |
There was a problem hiding this comment.
should this be a test inside of the existing describe?
There was a problem hiding this comment.
just wrapped a single test in its own describe didn't earn the extra indent. Flattened to a top-level it in e7dc25a alongside the existing top-level describes.
There was a problem hiding this comment.
No issues found across 3 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: This change additively exposes the already-computed unformatted HTML from composeReactEmail as a new field, with no modifications to existing behavior, full test coverage, and no risk of breakage.
Re-trigger cubic
…pper A one-test describe block was overkill for the new field; flatten it to a top-level `it` alongside the existing groupings.
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Auto-approved: The change is additive and backward-compatible, exposing an already-computed unformattedHtml field without altering existing html or text behavior, and includes a targeted test; the blast radius is limited to the serializer module with no risk to core logic, data integrity, or production...
Re-trigger cubic
Currently
composeReactEmailreturns only the Prettier-formatted HTML. For deeply-nested table-based emails (typical Stripo or Mailchimp exports), Prettier indentation accounts for ~78% of the output bytes — a 55 KB import becomes ~400 KB and pushes past Gmail's 102 KB clipping threshold, breaking open tracking and truncating content.The compact form is already computed inside the function — it's what
render()returns beforepretty()runs. This PR additively exposes it asunformattedHtml. The existinghtmlfield is unchanged, so no caller breaks.Measurements (deep Stripo-like input)
render()output (= newunformattedHtml)pretty()output (= existinghtml)Notes for reviewers
unformattedHtmlis non-optional in the return type since the value is always available.htmlortext.Summary by cubic
Expose compact, non-prettified HTML from
composeReactEmailasunformattedHtmlto reduce email size for nested table layouts and avoid Gmail’s 102 KB clipping.html(Prettier-formatted) andtextare unchanged; additive and backward-compatible.unformattedHtmlwhen persisting or sending; keephtmlfor source display views.Written for commit e7dc25a. Summary will update on new commits. Review in cubic