Skip to content

Commit

Permalink
Skip check for known Qwik components (#9482)
Browse files Browse the repository at this point in the history
  • Loading branch information
natemoo-re authored Dec 20, 2023
1 parent 97342d2 commit 72b26da
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .changeset/eight-ears-call.md
Original file line number Diff line number Diff line change
@@ -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)
1 change: 1 addition & 0 deletions packages/integrations/preact/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions packages/integrations/react/server-v17.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions packages/integrations/react/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
1 change: 1 addition & 0 deletions packages/integrations/solid/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand Down

0 comments on commit 72b26da

Please sign in to comment.