0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-06 22:10:10 -05:00

fix: adapter recognizes react 19 react.transitional.element

This commit is contained in:
jeroenpg 2024-12-08 23:13:21 +01:00
parent e21c7e67fd
commit 6449884ca9

View file

@ -5,7 +5,9 @@ import { incrementId } from './context.js';
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 reactLegacyTypeof = Symbol.for('react.element');
const reactTypeof = Symbol.for('react.transitional.element');
const supportedReactElementTypeofs = new Set([reactLegacyTypeof, reactTypeof]);
async function check(Component, props, children) {
// Note: there are packages that do some unholy things to create "components".
@ -28,7 +30,7 @@ async function check(Component, props, children) {
function Tester(...args) {
try {
const vnode = Component(...args);
if (vnode && vnode['$$typeof'] === reactTypeof) {
if (vnode && supportedReactElementTypeofs.has(vnode['$$typeof'])) {
isReactComponent = true;
}
} catch {}