-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[🐞] Confusing NoMatchingRenderer
failure with some components crossing Astro/Qwik component boundary
#228
Comments
You are missing to wrap your Qwik components with |
As mentioned in the workarounds section, we're intentionally using inline components in some cases and cannot adopt |
Oh yeah. Sorry, I missed that part. |
Hey everyone, 👋 just additional troubleshooting to try and help with this! Observation on this issue is that there no HTML element being rendered that is potentially the cause of this, Examples: this renders fine (fragment returning non-html element and html element) export const Counter = () => {
return <>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Explicabo perspiciatis quidem hic porro totam laudantium, necessitatibus harum debitis repellendus, eaque veritatis velit quo voluptatem ipsa excepturi commodi maiores vero incidunt!
<p>simple inline component</p></>;
}; this renders fine. (fragment returning html element) export const Counter = () => {
return <><p>simple inline component</p></>;
} this fails (fragment returning non-html element) export const Counter = () => {
return <>simple inline component</>;
}; |
In the provided example there's no HTML element being rendered, though this isn't true for every case where we've seen the error. Here's another case which renders a import type { PropsOf } from '@builder.io/qwik';
export const Counter = (props: PropsOf<'div'>) => {
return <div {...props}>simple inline component</div>;
}; |
Hey guys! I've gone ahead and opened a PR that should fix the issue in all cases. I believe this is because we left out a jsx transform function to detect if an inline component is a renderer in Astro. In an application where everything is just Qwik (or even Qwik React where it becomes a Qwik component), you don't need to do checks like this. But because Astro can include many different components on the page, each from different renderers, we need a way to be able to identify which framework is processing these files. In this case, I've added _jsxc (a jsx transform function used), to the list of identifiers. Ideally, we can find a way in the future that doesn't need to check internal transform functions.
Try this version and let me know if you're still running into any issues. |
Hmm, tried out that version in both the provided minimal repro case and in our actual project: it does fix the minimal repro (🎉) but unfortunately I'm still seeing the issues in our actual project. I'm not sure yet what the significant difference is but I'll spend some time and try to produce another repro case that covers it. |
OK I've updated the repro project with the following changes:
In this update, the error is reproduced specifically for |
@seleb this should be fixed in the latest version, let me know if you run into any other issues 😄 |
Looks like the latest update fixed all the issues we're seeing, thanks for the quick turnaround! |
Which component is affected?
Integration
Describe the bug
Hey there, I'm working a project that uses Astro + Qwik via this integration, and we're running into some cases where the SSR fails. The error output appears misleading, but I'm not familiar enough with the integration to guess at a specific cause.
Sample error output:
The provided reproduction link demonstrates the error based on the starter:
counter.tsx
has been modified to be an inline component that renders text inside a fragment, and is itself rendered inside the.astro
route. Any of the following changes resolves the issue:component$
wrapper tocounter.tsx
counter.tsx
with a<div>
tag<Counter />
inside another Qwik component that itself has an existing wrapper<div>
(e.g.Wrapper.tsx
). Note that this does not avoid the issue if it is rendered via children/slots (e.g.WrapperViaChildren.tsx
)Although the above changes may be workarounds in some cases, they may not always be viable:
component$
wrapper requires children to be converted to slots, which may affect behaviour (e.g. slots have no equivalent forchildren ? <HasChildren /> : <HasNoChildren />
). In our real use case, we've also seen significant decreases in server performance/TTFB when many inline components are converted to usecomponent$
, and cannot adopt this workaround.astro
components must be responsible for renderinghtml
/head
elementsReproduction
https://github.com/seleb/qwik-astro-ssr-failure-repro
Steps to reproduce
npm i
npm start
System Info
Additional Information
No response
The text was updated successfully, but these errors were encountered: