mirror of
https://github.com/withastro/astro.git
synced 2025-01-20 22:12:38 -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';
|
import StaticHtml from './static-html.js';
|
||||||
|
|
||||||
const slotName = (str) => str.trim().replace(/[-_]([a-z])/g, (_, w) => w.toUpperCase());
|
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) {
|
async function check(Component, props, children) {
|
||||||
// Note: there are packages that do some unholy things to create "components".
|
// 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) {
|
function Tester(...args) {
|
||||||
try {
|
try {
|
||||||
const vnode = Component(...args);
|
const vnode = Component(...args);
|
||||||
if (vnode && vnode['$$typeof'] === reactTypeof) {
|
if (vnode && supportedReactElementTypeofs.has(vnode['$$typeof'])) {
|
||||||
isReactComponent = true;
|
isReactComponent = true;
|
||||||
}
|
}
|
||||||
} catch {}
|
} catch {}
|
||||||
|
|
Loading…
Add table
Reference in a new issue