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

Skip check for known Qwik components (#9482)

This commit is contained in:
Nate Moore 2023-12-20 12:59:49 -06:00 committed by GitHub
parent 97342d218e
commit 72b26daf69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 0 deletions

View file

@ -0,0 +1,7 @@
---
'@astrojs/preact': patch
'@astrojs/react': patch
'@astrojs/solid-js': patch
---
Improves compatability with the [Qwik adapter](https://github.com/QwikDev/astro)

View file

@ -13,6 +13,7 @@ let consoleFilterRefs = 0;
function check(this: RendererContext, Component: any, props: Record<string, any>, children: any) {
if (typeof Component !== 'function') return false;
if (Component.name === "QwikComponent") return false;
if (Component.prototype != null && typeof Component.prototype.render === 'function') {
return BaseComponent.isPrototypeOf(Component);

View file

@ -20,6 +20,7 @@ function check(Component, props, children) {
return Component['$$typeof']?.toString().slice('Symbol('.length).startsWith('react');
}
if (typeof Component !== 'function') return false;
if (Component.name === "QwikComponent") return false;
if (Component.prototype != null && typeof Component.prototype.render === 'function') {
return React.Component.isPrototypeOf(Component) || React.PureComponent.isPrototypeOf(Component);

View file

@ -22,6 +22,7 @@ async function check(Component, props, children) {
return Component['$$typeof'].toString().slice('Symbol('.length).startsWith('react');
}
if (typeof Component !== 'function') return false;
if (Component.name === "QwikComponent") return false;
// Preact forwarded-ref components can be functions, which React does not support
if (typeof Component === 'function' && Component['$$typeof'] === Symbol.for('react.forward_ref'))

View file

@ -6,6 +6,7 @@ const slotName = (str: string) => str.trim().replace(/[-_]([a-z])/g, (_, w) => w
function check(this: RendererContext, Component: any, props: Record<string, any>, children: any) {
if (typeof Component !== 'function') return false;
if (Component.name === "QwikComponent") return false;
const { html } = renderToStaticMarkup.call(this, Component, props, children);
return typeof html === 'string';
}