mirror of
https://github.com/resend/react-email.git
synced 2026-09-14 14:18:02 +08:00
chore(render): remove use of react-promise-suspense (#2610)
Co-authored-by: Lucas Vieira <vieiralucas4@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@react-email/render": patch
|
||||
---
|
||||
|
||||
Remove unused `react-promise-suspense`
|
||||
@@ -115,8 +115,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"html-to-text": "^9.0.5",
|
||||
"prettier": "^3.5.3",
|
||||
"react-promise-suspense": "^0.3.4"
|
||||
"prettier": "^3.5.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^18.0 || ^19.0 || ^19.0.0-rc",
|
||||
@@ -125,7 +124,6 @@
|
||||
"devDependencies": {
|
||||
"@edge-runtime/vm": "5.0.0",
|
||||
"@types/html-to-text": "9.0.4",
|
||||
"@types/prettier": "3.0.0",
|
||||
"@types/react": "npm:types-react@19.0.0-rc.1",
|
||||
"@types/react-dom": "npm:types-react-dom@19.0.0",
|
||||
"jsdom": "26.1.0",
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
* @vitest-environment jsdom
|
||||
*/
|
||||
|
||||
import { createElement } from 'react';
|
||||
import usePromise from 'react-promise-suspense';
|
||||
import { createElement, use } from 'react';
|
||||
import { Preview } from '../shared/utils/testing/preview';
|
||||
import { Template } from '../shared/utils/testing/template';
|
||||
import { render } from './render';
|
||||
@@ -126,11 +125,9 @@ describe('render on the browser environment', () => {
|
||||
});
|
||||
|
||||
it('waits for Suspense boundaries to ending before resolving', async () => {
|
||||
const htmlPromise = fetch('https://example.com').then((res) => res.text());
|
||||
const EmailTemplate = () => {
|
||||
const html = usePromise(
|
||||
() => fetch('https://example.com').then((res) => res.text()),
|
||||
[],
|
||||
);
|
||||
const html = use(htmlPromise);
|
||||
|
||||
return <div dangerouslySetInnerHTML={{ __html: html }} />;
|
||||
};
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
* @vitest-environment node
|
||||
*/
|
||||
|
||||
import { Suspense } from 'react';
|
||||
import usePromise from 'react-promise-suspense';
|
||||
import { Suspense, use } from 'react';
|
||||
import { Preview } from '../shared/utils/testing/preview';
|
||||
import { Template } from '../shared/utils/testing/template';
|
||||
import { render } from './render';
|
||||
@@ -85,12 +84,10 @@ describe('render on node environments', () => {
|
||||
expect(actualOutput).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('that it properly waits for Suepsense boundaries to resolve before resolving', async () => {
|
||||
it('that it properly waits for Suspense boundaries to resolve before resolving', async () => {
|
||||
const htmlPromise = fetch('https://example.com').then((res) => res.text());
|
||||
const EmailTemplate = () => {
|
||||
const html = usePromise(
|
||||
() => fetch('https://example.com').then((res) => res.text()),
|
||||
[],
|
||||
);
|
||||
const html = use(htmlPromise);
|
||||
|
||||
return <div dangerouslySetInnerHTML={{ __html: html }} />;
|
||||
};
|
||||
|
||||
Generated
-14
@@ -876,9 +876,6 @@ importers:
|
||||
react-dom:
|
||||
specifier: ^19.0.0
|
||||
version: 19.0.0(react@19.0.0)
|
||||
react-promise-suspense:
|
||||
specifier: ^0.3.4
|
||||
version: 0.3.4
|
||||
devDependencies:
|
||||
'@edge-runtime/vm':
|
||||
specifier: 5.0.0
|
||||
@@ -886,9 +883,6 @@ importers:
|
||||
'@types/html-to-text':
|
||||
specifier: 9.0.4
|
||||
version: 9.0.4
|
||||
'@types/prettier':
|
||||
specifier: 3.0.0
|
||||
version: 3.0.0
|
||||
'@types/react':
|
||||
specifier: ^19.0.1
|
||||
version: 19.0.1
|
||||
@@ -4265,10 +4259,6 @@ packages:
|
||||
'@types/phoenix@1.6.6':
|
||||
resolution: {integrity: sha512-PIzZZlEppgrpoT2QgbnDU+MMzuR6BbCjllj0bM70lWoejMeNJAxCchxnv7J3XFkI8MpygtRpzXrIlmWUBclP5A==}
|
||||
|
||||
'@types/prettier@3.0.0':
|
||||
resolution: {integrity: sha512-mFMBfMOz8QxhYVbuINtswBp9VL2b4Y0QqYHwqLz3YbgtfAcat2Dl6Y1o4e22S/OVE6Ebl9m7wWiMT2lSbAs1wA==}
|
||||
deprecated: This is a stub types definition. prettier provides its own type definitions, so you do not need this installed.
|
||||
|
||||
'@types/prismjs@1.26.5':
|
||||
resolution: {integrity: sha512-AUZTa7hQ2KY5L7AmtSiqxlhWxb4ina0yd8hNbl4TWuqnv/pFP0nDMb3YrfSBf4hJVGLh2YEIBfKaBW/9UEl6IQ==}
|
||||
|
||||
@@ -12797,10 +12787,6 @@ snapshots:
|
||||
|
||||
'@types/phoenix@1.6.6': {}
|
||||
|
||||
'@types/prettier@3.0.0':
|
||||
dependencies:
|
||||
prettier: 3.5.3
|
||||
|
||||
'@types/prismjs@1.26.5': {}
|
||||
|
||||
'@types/prompts@2.4.9':
|
||||
|
||||
Reference in New Issue
Block a user