S
SolidJS•10mo 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•10mo ago
The link to your github repo 404s, you might've set it to private accidentally?
Mirardes
MirardesOP•10mo ago
yes my bad ! now it is public 🙂
Brendonovich
Brendonovich•10mo 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
MirardesOP•10mo 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•10mo 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
MirardesOP•10mo 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•10mo 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
MirardesOP•10mo ago
just for your information the link doesn't exist
bigmistqke
bigmistqke•10mo ago
Mirardes
MirardesOP•10mo 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
MirardesOP•10mo ago
Mirardes
MirardesOP•10mo ago
As you the content is loaded and disapear automatically ... Output is static Nothing in DOM 0-o
Mirardes
MirardesOP•10mo ago
No description
Mirardes
MirardesOP•10mo ago
found nevermind
Want results from more Discord servers?
Add your server