Client-only resource with SSR
Is there a way to make a client-only resource? that is, don't even bother on the server, render the fallback, then start fetching immediately on the client? I can use refetch in an effect but it briefly returns the server value before refetch starts without showing the fallback. Using a source signal does not render the fallback on the server
3 Replies
Just wrap the resource in an onMount.
Or use the ssrLoadFrom: "initial" option in the resource.
ssrLoadFrom: "initial" doesn't run the fetcher on the client as far as I can tell:
Also I don't think there's a way to trigger Suspense from a resource inside onMount
You need to evaluate the resource for the fetcher to run.
Also, Suspense will work for all resources inside the same component.