Router unexpectedly slow #2208
Replies: 6 comments
-
You can see it live here. |
Beta Was this translation helpful? Give feedback.
-
I've seen the exact same thing. Rendering the new data is completely delayed until the async function in Changing your example like below should fix it, even though I don't think this is what it should be const [resource, {refetch}] = createResource(() => {
const pageName = getPageName()
return new Promise<string>((resolve) => {
setTimeout(() => {
resolve(`Hi ${pageName}!`)
}, 3000)
})
})
createEffect(() => {
refetch(getPageName())
}) Does anyone know what would be the correct way to fix this? Is it possibly a bug in |
Beta Was this translation helpful? Give feedback.
-
I’d been waiting for a response here for ages, but it never came. My solution was to ditch solidjs/router and never use suspend. Those two features are shaky. Without them, solid is reliable. So long as you don’t accidentally create an infinite effect loop. That is another area that could use some improvement. |
Beta Was this translation helpful? Give feedback.
-
This is by design. The router bakes in Transitions which mirror paint holding of routing which rendering offscreen. There is an isRouting hook to provide affordances. You can also nest Suspense boundaries as new ones will not participate in Transitions. You can see more on Transistions here: |
Beta Was this translation helpful? Give feedback.
-
Exactly. So the router (and suspense) is suitable for SSR, but broken in client-side-only scenarios. React is having similar issues around suspense, I hear. I’ve been holding off for the WIP suspense primitives I read about in some issue around here. Never heard about nesting suspense boundaries though. How would that solve the issue here? Edit: I tried to nest suspense boundaries like this, but it did not work. <Route
path={"/page/:name"}
component={PageXWrapperComp}
/>
// ...
function PageXWrapperComp(props: RouteSectionProps) {
return (
<Suspense fallback={"Loading PageXComp inside PageXWrapperComp..."}>
<PageXComp {...props} />
</Suspense>
);
} Going from Page A to Page B is still slow, and does not show the suspense fallback message. How did you mean that? |
Beta Was this translation helpful? Give feedback.
-
Thissss dissssscusssssionnnn issss rattttttherrrrr sloowwwwww. |
Beta Was this translation helpful? Give feedback.
-
In the following sample code (which does not work in the Playground for some reason), waiting for Page A to load and then switching to Page B is unexpectedly slow. All other pages work fine. It seems to suspend before the navigation could happen.
The workaround is commented out in AppComp.
Is this a bug, or am I doing something wrong? Is there a better solution?
Beta Was this translation helpful? Give feedback.
All reactions