-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Describe the bug
When passing a context to the Router with the trpc.useUtils() hook causes an obscure error.
function MyApp() {
const utils = trpc.useUtils();
return <RouterProvider router={router} context={{ trpcClient: utils }} />;
}The error is Uncaught TypeError: contextMap[utilName] is not a function. It occurs in the <Explorer /> component in the DevTools.
I have found a temporary workaround by attempting to get the context panel to be in the collapsed state. As soon as I expand it, it throws this error.
In the stackblitz, I am unable to collapse the context section by default. However, it throws the error regardless.
From my testing, I am still unsure what types of items passed to the context field in the RouterProvider are causing the error. I have tried strings, numbers, variables from useState without it causing this error.
Your Example Website or App
https://stackblitz.com/edit/github-4ycrcx?file=client%2Fmain.tsx
Steps to Reproduce the Bug or Issue
- Go to Stackblitz above
- See an error concurring
- Change the trpcClient on line 42 to a string or number or any other variable and notice that it works
Expected behavior
The DevTools should not throw an error when it sees the trpc utils.
Screenshots or Videos
No response
Platform
- OS: Linux
- Browser: Chrome
- Version: Latest
Additional context
No response