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:
parent
e21c7e67fd
commit
6449884ca9
1 changed files with 4 additions and 2 deletions
|
@ -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 {}
|
||||
|
|
Loading…
Reference in a new issue