From 0b12414315fa81ded96587779c63c74400466078 Mon Sep 17 00:00:00 2001 From: Happydev <81974850+MoustaphaDev@users.noreply.github.com> Date: Fri, 28 Oct 2022 02:05:18 +0000 Subject: [PATCH] remove unnecessary `ReactDOM.renderToString` operation (#5218) * remove useless `ReactDOM.renderToString` operation * chore: add changeset --- .changeset/tasty-rules-sleep.md | 5 +++++ packages/integrations/react/server.js | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .changeset/tasty-rules-sleep.md diff --git a/.changeset/tasty-rules-sleep.md b/.changeset/tasty-rules-sleep.md new file mode 100644 index 000000000..0bc19c626 --- /dev/null +++ b/.changeset/tasty-rules-sleep.md @@ -0,0 +1,5 @@ +--- +'@astrojs/react': patch +--- + +remove unnecessary `ReactDOM.renderToString` operation diff --git a/packages/integrations/react/server.js b/packages/integrations/react/server.js index 6dd289c99..1ebd044cf 100644 --- a/packages/integrations/react/server.js +++ b/packages/integrations/react/server.js @@ -75,7 +75,6 @@ async function renderToStaticMarkup(Component, props, { default: children, ...sl const vnode = React.createElement(Component, newProps); let html; if (metadata && metadata.hydrate) { - html = ReactDOM.renderToString(vnode); if ('renderToReadableStream' in ReactDOM) { html = await renderToReadableStreamAsync(vnode); } else {