S
SolidJS•5mo ago
Mirardes

Lazy Loading make a blank page when component change

Hi, I have an issue with Lazy Loading for solid-start. Actually, I have implement a switch component with lazy loading enabled but when I change a component (who is lazy loaded), the page become blank during less than 1 seconds... Can someone can help me ? It's reproducible with builded repo : pnpm build && node .output/server/index.mjs Repro : https://github.com/qlaffont/test-lazy
14 Replies
iFreilicht
iFreilicht•5mo ago
The link to your github repo 404s, you might've set it to private accidentally?
Mirardes
Mirardes•5mo ago
yes my bad ! now it is public 🙂
Brendonovich
Brendonovich•5mo ago
The flicker is the lazy loaded routes having to lazy load. You can wrap the signal updates in startTransition to delay the page from updating until the root suspense is resolved
Mirardes
Mirardes•5mo ago
Do you have any example where I can take inspiration ? Because the strange thing is the parent comparent rerender but it is only the children who need to rerender and who is lazy loaded To explain, normally the background should not go to blank
Brendonovich
Brendonovich•5mo ago
The components lazy loading causes the nearest suspense boundary to suspend In this case the nearest boundary is at the root, so everything is being removed while the component loads startTransition(() => setSignal()) should do what you want The thing to think about here is what is supposed to render while the component lazy loads? The answer is the nearest suspense fallback
Mirardes
Mirardes•5mo ago
I don't see a StartTransition on the documentation can you explain more on how to do it or can you make a commit on the repro please ?
bigmistqke 🌈
bigmistqke 🌈•5mo ago
i looked at ur repo wrap the <switch/> in DisplaySteps with a <Suspense/>
The thing to think about here is what is supposed to render while the component lazy loads? The answer is the nearest suspense fallback
this is the crucial idea behind Suspense u can use useTransition and startTransition too, but they more like escape-hatches tutorial of useTransitions explains its usecase nicely: https://www.solidjs.com/tutorial/async_transitions and startTransition is like useTransition but without pending state: https://www.solidjs.com/docs/latest/api#starttransition
Mirardes
Mirardes•5mo ago
just for your information the link doesn't exist
Mirardes
Mirardes•5mo ago
Thanks for your help @Brendonovich & @bigmistqke I close the post I reopen the post In my repro the bug is still present I will check if I know why and if not I will ask if someone is available to check my private repro in visio or to give limited access I can't reproduce it with my repro but on my private repro I have the error. @bigmistqke / @Brendonovich If you have 5 min It will be cool please 🙂
Mirardes
Mirardes•5mo ago
Mirardes
Mirardes•5mo ago
As you the content is loaded and disapear automatically ... Output is static Nothing in DOM 0-o
Mirardes
Mirardes•5mo ago
No description
Mirardes
Mirardes•5mo ago
found nevermind
Want results from more Discord servers?
Add your server
More Posts
Error "RequestEvent is missing." for cloudflare buildHi, I have updated to the latest 0.5.4 solid-start beta and started to see this error when building Blank array of documents from Firestore - createEffect(), createSignal()Hi all, I'm starting with web frameworks for the first time and chose SolidJS. I'm stuck... retrieviCustom auth solidstart by prismaCan anyone help me make my authorization on solidstart? I have orm prisma. I created a user table,Derived data in a store vs reconcileHey there, I'm trying to somehow have derived/computed data sit in a rather deeply nested store, ie Best practices for reactively updating a storeI know you can use derived signals in SolidJS, but, is there a way to somehow make a store "derive" Suggestions for refactoring an async image component?Hi, I've written a small async image wrapper for a project I'm working on, and I'm wondering if anyweird behavior: a button declared in TSX with onClick does not have onClick in the final html?o/ i have this ```tsx export const FORM_URL = "https://forms.gle/..." export default function App()Should event: APIevent have client cookies on SSR?```js import { type APIEvent } from "@solidjs/start/server/types"; import { app } from "./elysia"; Uncaught ReferenceError: React is not definedHello! I am using "solid-js": "^1.7.5" and "solid-start": "^0.2.32" for my solidjs project, but Solid-Icons with Webpack and Module Federation?I've been trying to get Solid-Icons to work with the create-mf-app function (Jack Herrington and Mod