#How to configure tanstack start to completely opt out of SSR while keeping server functions?
28 messages · Page 1 of 1 (latest)
as of now you cannot completely disable SSR
root route will currently be SSRed no matter what
we have a SPA mode for start planned though
for all other routes you can disable SSR via defaultSsr: false in router options
Can I return a promise from loader function with ssr disabled, using server function just as rpc called from the client, and than await it on the client? coundn't figure out how to get this to work
what happens if you try this?
I see this in console and a blank page which take 3 seconds to load
It seems like loader function runs on the server and blocks for some reason
Even with disabled SSR
can you provide this as a git repo?
Yes, sure
One more thing, even if i await the promise it still blocks the page. I thought that with no ssr, loader would run on the client and make an http request
no, loader is still executed on the server
that would only happen when we have the SPA mode in the future
"ssr: false" currently just means that nothing is RENDERED on the server, but the loaders still run there
Okay, got it, thanks! Is there some workarounds to make it work now? Using tanstack query and using server fn as query function should be fine
to make what work?
to make all requests from the client
Thank you
so this works as expected on a prod build
but not in dev
i guess this is caused by the
Uncaught Error: @vitejs/plugin-react can't detect preamble. Something is wrong. See https://github.com/vitejs/vite-plugin-react/pull/11#discussion_r430879201
at __root.tsx:1:65
we have an issue open for this here: https://github.com/TanStack/router/issues/3328
Also, I have reenabled the SSR (rolled back to defaults) and streaming works as expected, but the onClick function on button doesn't work at all. And the same error appears in the console
Uncaught Error: @vitejs/plugin-react can't detect preamble. Something is wrong.