diff options
author | 2025-01-10 10:17:46 +0800 | |
---|---|---|
committer | 2025-01-10 10:17:46 +0800 | |
commit | 51ab7b5722acecce722fb404ca6bc152a109c9e5 (patch) | |
tree | d36b73517c3437652a5e1d6e28673fdd102b3bae /packages/integrations/react/server.js | |
parent | df0c5665c1c1bbbaa878d01bca28d6558762ea00 (diff) | |
download | astro-51ab7b5722acecce722fb404ca6bc152a109c9e5.tar.gz astro-51ab7b5722acecce722fb404ca6bc152a109c9e5.tar.zst astro-51ab7b5722acecce722fb404ca6bc152a109c9e5.zip |
Support checking react 19 components (#12948)
Diffstat (limited to 'packages/integrations/react/server.js')
-rw-r--r-- | packages/integrations/react/server.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/packages/integrations/react/server.js b/packages/integrations/react/server.js index 9c3c309cc..50d6bd94b 100644 --- a/packages/integrations/react/server.js +++ b/packages/integrations/react/server.js @@ -6,6 +6,7 @@ import StaticHtml from './static-html.js'; const slotName = (str) => str.trim().replace(/[-_]([a-z])/g, (_, w) => w.toUpperCase()); const reactTypeof = Symbol.for('react.element'); +const reactTransitionalTypeof = Symbol.for('react.transitional.element'); async function check(Component, props, children) { // Note: there are packages that do some unholy things to create "components". @@ -28,7 +29,10 @@ async function check(Component, props, children) { function Tester(...args) { try { const vnode = Component(...args); - if (vnode && vnode['$$typeof'] === reactTypeof) { + if ( + vnode && + (vnode['$$typeof'] === reactTypeof || vnode['$$typeof'] === reactTransitionalTypeof) + ) { isReactComponent = true; } } catch {} |