-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Astro fails to load lazy SolidJS components after server startup due to race condition #6912
Comments
After investigating I think that the issue is better visualized by this fork which shows a suspense fallback message rather than nothing. I believe it's because according to Solid's tutorial on lazy the first time a component loads in solidJS with lazy it's dynamically loads.
I seem to remember something saying that Astro does not support async in UI components. If that's the case I don't know what a solution would be for this, is there someway to await suspense boundaries in SolidJS? |
If this is an async problem it looks like #6791 maybe would solve this issue. |
Yep, let's try and get that PR merged. |
@howagain does the latest version of the solid integrations resolves the issue on your side? |
No response, so closing, please open another issue if you have the problem. |
What version of
astro
are you using?2.3.1
Are you using an SSR adapter? If so, which one?
Node
What package manager are you using?
npm
What operating system are you using?
Mac
What browser are you using?
Chrome
Describe the Bug
When starting up the server for the first time, a top level lazy component does not render on the server and the complete HTML response is sent before that render branch finishes.
I believe that this is because Astro does not await inside components. But it does cache the result of repeated calls to render. Resulting in a race condition.
However, what is interesting is that this behavior is not only intermittent but 3 states are possible.
In the example provided you'll notice that the text "My App" appears but the buttons below do not appear on first render. But if you refresh the dev server page you will see the buttons appear. Inspect the HTML between attempts and you will see the buttons are not there in the first render but are there in subsequent renders.
*Note in the example provided, I have only seen 1 & 3 occur due to the hydration occurring so fast.
If you are struggling to reproduce, start and stop the dev server between attempts.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-efihju?file=src%2Fpages%2Findex.astro
Participation
The text was updated successfully, but these errors were encountered: