react-email icon indicating copy to clipboard operation
react-email copied to clipboard

Issue with - react-email/components >=v0.29. Preview Code adds misplaced line breaks causing buttons not render in Outlook 2016 & 2019 clients

Open Wigwamwam opened this issue 1 year ago • 11 comments

Describe the Bug

Hey, react-email button component causes rendering issues on outlook clients 2016 and 2019. This is only present on react-email/component v0.29 or above. The button and any subsequent components do not render.

Packages:

  • "@react-email/components": "0.0.29",
  • "@react-email/tailwind": "1.0.4",
  • "react-email": "3.0.4",

I believe this is due to the code preview incorrectly prettifies the code with miss placed linebreaks as I have compared the output code between 0.28 and 0.29 and the only difference is the linebreaks.

Which package is affected (leave empty if unsure)

@react-email/button, @react-email/components

Link to the code that reproduces this issue

private repo

To Reproduce

  • use react email template: https://demo.react.email/preview/notifications/vercel-invite-user?view=source&lang=jsx
  • Test the email rendering using Testi.at or a similar tool to preview the email in Microsoft Outlook 2016 and 2019.
  • Observe how the button components fail to render correctly in the targeted Outlook versions along with subsequent components.

Below is an example of the rendering issue: image

This is what it should look like (this is taken form your website so I expect outlook to produce a lower quality version): image

Expected Behavior

When I use react-email/component v0.28 it appears correctly

What's your node version? (if relevant)

No response

Wigwamwam avatar Dec 10 '24 16:12 Wigwamwam

Following on from this I believe it is due to the code preview incorrectly prettifies the code with miss placed linebreaks

Wigwamwam avatar Dec 10 '24 16:12 Wigwamwam

I have a very similar problem with buttons, but it is not correlated with preview Code. Apparently something changed between react-render 1.0.2 and 1.0.3 . I believe it broke the "if mso" syntax so outlook is no longer able to parse it (prettier change).

This is the diff (before, after):

<                     <td><a href="{{accept-invitation-url}}" style="line-height:normal;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;background-color:#02deaa;border:0px solid #333333;color:#ffffff;font-size:18px;font-weight:600;letter-spacing:0px;padding:16px 22px 16px 22px;text-align:center;text-transform:uppercase;box-shadow:0px 3px 0px #00C093;border-radius:35px;border-style:solid" target="_blank"><span><!--[if mso]><i style="mso-font-width:366.66666666666663%;mso-text-raise:24" hidden>&#8202;&#8202;&#8202;</i><![endif]--></span><span style="max-width:100%;display:inline-block;line-height:120%;mso-padding-alt:0px;mso-text-raise:12px">Accept Invitation</span><span><!--[if mso]><i style="mso-font-width:366.66666666666663%" hidden>&#8202;&#8202;&#8202;&#8203;</i><![endif]--></span></a></td>
---
>                     <td>
>                       <a
>                         href="{{accept-invitation-url}}"
>                         style="line-height:normal;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;background-color:#02deaa;border:0px solid #333333;color:#ffffff;font-size:18px;font-weight:600;letter-spacing:0px;padding:16px 22px 16px 22px;text-align:center;text-transform:uppercase;box-shadow:0px 3px 0px #00C093;border-radius:35px;border-style:solid"
>                         target="_blank"
>                         ><span
>                           ><!--[if mso
>                             ]><i
>                               style="mso-font-width:366.66666666666663%;mso-text-raise:24"
>                               hidden
>                               >&#8202;&#8202;&#8202;</i
>                             ><!
>                           [endif]--></span
>                         ><span
>                           style="max-width:100%;display:inline-block;line-height:120%;mso-padding-alt:0px;mso-text-raise:12px"
>                           >Accept Invitation</span
>                         ><span
>                           ><!--[if mso
>                             ]><i
>                               style="mso-font-width:366.66666666666663%"
>                               hidden
>                               >&#8202;&#8202;&#8202;&#8203;</i
>                             ><!
>                           [endif]--></span
>                         ></a
>                       >
>                     </td>


project0 avatar Dec 18 '24 08:12 project0

Any updates on this?

ragunaru avatar Jan 08 '25 07:01 ragunaru

@ragunaru #1839 Should fix it once it is released. Will tell you all once we release it on canary.

gabrielmfern avatar Jan 08 '25 14:01 gabrielmfern

Just released the fix for this in canary @react-email/[email protected]/@react-email/[email protected]

gabrielmfern avatar Jan 22 '25 13:01 gabrielmfern

I'm experiencing the same issue. Just checked the canary version - did not fix it. Reverting back to "@react-email/components": "0.0.28" for now

MartinXPN avatar Jan 25 '25 19:01 MartinXPN

It is somehow better, but still broken with not rendering the text correctly, characters > suddenly appaears. e.g. >Konto anlegen> instead of Konto anlegen

Image

Image

project0 avatar Jan 27 '25 08:01 project0

@project0 Thanks for letting me know! I tracked it down to some obscure behaviors on Prettier, and our way to customize it was not playing very well. I changed it on this PR, and we should release a canary for it soon, #1881 .

Meanwhile, you all can simply disable pretty to avoid the issue.

gabrielmfern avatar Jan 27 '25 18:01 gabrielmfern

Released #1881 on @react-email/[email protected]/@react-email/components 0.0.33-canary.1, would appreciate you all to test it and see if things are now working

gabrielmfern avatar Jan 30 '25 16:01 gabrielmfern

@gabrielmfern thanks, it looks good to me now 💪

project0 avatar Feb 05 '25 12:02 project0

Closing with the fix released on @react-email/[email protected]/@react-email/[email protected]!

gabrielmfern avatar Feb 10 '25 09:02 gabrielmfern