ry
ry
Explore posts from servers
SSolidJS
Created by ry on 4/6/2024 in #support
Resource loading from param blocks navigation
https://stackblitz.com/edit/github-xdufjx?file=src%2Froutes%2Fdetail%2F%5Bid%5D%2Findex.tsx on latest solidstart
export default function DetailPage() {
const params = useParams();
const [data] = createResource(
() => params.id,
(id) => getData(id)
);
return (
<main>
<h1>Detail /{params.id}</h1>

<Suspense fallback={<div>...</div>}>
<div>{data()?.join(' ')}</div>
</Suspense>
</main>
);
}
export default function DetailPage() {
const params = useParams();
const [data] = createResource(
() => params.id,
(id) => getData(id)
);
return (
<main>
<h1>Detail /{params.id}</h1>

<Suspense fallback={<div>...</div>}>
<div>{data()?.join(' ')}</div>
</Suspense>
</main>
);
}
When navigating to /details/a from /, suspense fallback shows. After data loads, now navigate to detail b and see how the page freezes. You can't go to home during this. Shouldn't the suspense show and not block everything when going a -> b? Not sure if i'm doing something wrong here.
12 replies
SSolidJS
Created by ry on 7/21/2023 in #support
Using `createResource` without triggering suspense
I'm trying to use createResource without triggering Suspense. I realised that data.latest still triggers suspense on first fetch, but providing an initialValue to the resource seems to prevent this. Is this reliable behaviour to rely on? https://playground.solidjs.com/anonymous/25b3cb5c-54b4-4be5-85c1-531ddf2e369c
1 replies
SSolidJS
Created by ry on 1/27/2023 in #support
Handling locale dates when SSR
I am trying to display a date with date.toLocaleDateString, however as the page is SSR it is instead showing as the server's locale. Is there a pattern to handle this?
18 replies