vildantursic
vildantursic16mo ago

Pass additional data from `useQuery` to context

For splitLink there is a way to pass context value through useQuery as second param { trpc: { context: { x: y } } }, but it doesn't propagate further from splitLink. Is there a similar way to pass some data to context (I want to update context data dynamicaly) after its initialization createContext? I have case where my app have route e.g. /[appName]/machine/[x] and I would like to pass appName to context so that I don't have to pass it each time with other params on useQuery. Is that possible and what would be the best way? I was trying this trpc.machine.useQuery({ id: x }, { trpc: { ctx: { app: "<appName>" } } }) and similar variations.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?