remove unnecessary ReactDOM.renderToString
operation (#5218)
* remove useless `ReactDOM.renderToString` operation * chore: add changeset
This commit is contained in:
parent
25a6360a60
commit
0b12414315
2 changed files with 5 additions and 1 deletions
5
.changeset/tasty-rules-sleep.md
Normal file
5
.changeset/tasty-rules-sleep.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@astrojs/react': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
remove unnecessary `ReactDOM.renderToString` operation
|
|
@ -75,7 +75,6 @@ async function renderToStaticMarkup(Component, props, { default: children, ...sl
|
||||||
const vnode = React.createElement(Component, newProps);
|
const vnode = React.createElement(Component, newProps);
|
||||||
let html;
|
let html;
|
||||||
if (metadata && metadata.hydrate) {
|
if (metadata && metadata.hydrate) {
|
||||||
html = ReactDOM.renderToString(vnode);
|
|
||||||
if ('renderToReadableStream' in ReactDOM) {
|
if ('renderToReadableStream' in ReactDOM) {
|
||||||
html = await renderToReadableStreamAsync(vnode);
|
html = await renderToReadableStreamAsync(vnode);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue