Replies: 2 comments 2 replies
|
can you please share a complete minimal reproducer project as a git repo? also, you should use the query integration https://tanstack.com/router/latest/docs/integrations/query |
|
I hit this exact class of error with Start and traced it to export function createClientRpc(functionId: string) {
const url = process.env.TSS_SERVER_FN_BASE + functionId
// ...
}That That transform is scoped to the route module graph, route files and whatever gets pulled in through the compiler's known entry points, not to This matches what the import-protection feature is meant to catch (see the discussion right next to yours, #7390), so I'd call it a real gap rather than a misuse on your part, but the practical fix today is to not import server-function modules directly into // routes/__root.tsx
export const Route = createRootRouteWithContext<RouterContext>()({
beforeLoad: async () => {
const authSession = await getSession()
return { authSession }
},
})and drop the eager |
Uh oh!
There was an error while loading. Please reload this page.
I defined some server functions like this:
Then, I try to import from
src/router.tsxso that I can inject the session as router context:And I get an error in my browser console:
Is this a bug, or am I misusing the framework by trying to import server functions here? I'm inclined to think it's a bug because the error is being thrown from a function that I'm not actually calling (the stack trace points to the call to
.handler()inlistActiveSubscriptions).All reactions