-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Lazily imported components suffer from FOUC #5137
Comments
* add failing test for #5137 * partial fix for #5137 * defer gathering of styles * fix typechecking * try and nudge turbo into not breaking everything * include dynamically imported styles during dev SSR * changeset * rename some stuff to make it clearer * simplify, and dont follow dynamic imports from entry * tidy up * tidy up * tidy up
Not sure if that's related but as of 1.0.0-next.370, all the CSS of all the dynamic components gets loaded from the first page load. |
Sorry I haven't precised that I'm not loading the components with that pattern (lazy load when the component has mounted).
|
This was fixed by #5138. @PlopTheReal it's unclear what your last comment has to do with this thread — if you're experiencing a bug, please open a new issue with a repro |
Describe the bug
A useful pattern is to dynamically import a component inside a
load
function:The problem is that results in FOUC, because SvelteKit only injects CSS for static dependencies when server-side rendering. The styles don't appear until the component is imported.
Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-qstyga?file=src%2Froutes%2Findex.svelte,src%2Flib%2FLazy.svelte&terminal=dev
Logs
No response
System Info
Severity
serious, but I can work around it
Additional Information
No response
The text was updated successfully, but these errors were encountered: