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:
parent
97342d218e
commit
72b26daf69
5 changed files with 11 additions and 0 deletions
7
.changeset/eight-ears-call.md
Normal file
7
.changeset/eight-ears-call.md
Normal 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)
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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'))
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue