-
Notifications
You must be signed in to change notification settings - Fork 171
Open
Description
Describe the bug
I create routes like this
{
path: "/",
component: (props) => (
<Suspense fallback={<Loading />}>{props.children}</Suspense>
),
children: [
{
path: "",
component: Page,
},
{
path: "test",
component: (props) => (
<Suspense fallback={<Loading1 />}>{props.children}</Suspense>
),
children: [
{
path: "",
component: Page1,
},
],
},
],
}
in Page and Page1's functions, I code like this to show fallback
// src/pages/page.tsx
const Page: Component = () => {
let num = 1;
const [data, { refetch }] = createResource(async () => {
await sleep(1000);
return ++num;
});
return (
<div style={{ display: "flex", gap: "4px" }}>
home-{data()}
<span onClick={refetch}>click to loading</span>
<A href="https://github.com/test">to /test</A>
{/* in src/pages/test/pages this link is to home and href is '/' */}
</div>
);
};
when I refech and first load Page, Suspense works
but when I go to '/test' then to '/',Suspense doesn't work
the page stay '/test' for 1s, and then turn to '/'
Your Example Website or App
https://codesandbox.io/p/devbox/428phl
Steps to Reproduce the Bug or Issue
- start the project
- click 'click to loading' and find Suspense show fallback
- click 'to /test' and find Suspense show fallback
- click 'to /' and find Suspense doesn't work.
Expected behavior
when swicthing routes. Suspense can always show fallback
Screenshots or Videos
No response
Platform
- OS: Linux( in window docker)
- Browser: Chrome
- Version:
"@solidjs/router": "^0.15.3",
"solid-js": "^1.9.3"
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels