Using the beforeLoad in the root component breaks UI functionality (shadcn ui)?
In my root component, I have a simple server function that fetches the user and session from the session cookie in the beforeLoad function.
app/routes/__root.tsx
As soon I add this line of code or really any server function down the tree in beforeLoad, my dialogs, dropdowns, and any other interactive component no longer becomes interactive. I am using the default configuration for shadcn UI and without this line, all of my features become interactive again.
I was under the impression that all route components were client side components in TanStack start even though it's an SSR framework? Anyone want to break down what's happening here for me?
I am trying to use TanStack query with the ensureQueryData and useSuspenseQuery pattern in the app, but I don't want all my buttons to break as a result :/
5 Replies
quickest-silver•11mo ago
what does
validateRequest
do? a complete minimal example would be helpfulrival-blackOP•11mo ago
It just checks for a session cookie, the name could be more obvious but the functionality overall is this.
quickest-silver•11mo ago
what does this mean? " my dialogs, dropdowns, and any other interactive component no longer becomes function. "
rival-blackOP•11mo ago
Sorry I mean to say interactive.
As in when I click on a select, nothing happens. When I click on a trigger for a modal, nothing happens.
If I remove this line of code, they all become interactive again.
Sorry, ESL moment lol
This line of code meaning the beforeLoad logic
bump
This feels like I'm missing something key in my understanding of client/server relations in tanstack start
quickest-silver•11mo ago
please provide a minimal complete example, e.g. by forking one of the existing examples on stackblitz