Provide environment information
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 16.14.2 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 7.17.0 - /usr/local/bin/npm
npmPackages:
@tanstack/react-query: ^4.3.8 => 4.6.0
@trpc/client: ^10.14.1 => 10.14.1
@trpc/next: ^10.14.1 => 10.14.1
@trpc/react-query: ^10.14.1 => 10.14.1
@trpc/server: ^10.14.1 => 10.14.1
next: ^13.2.1 => 13.2.1
react: ^18.2.0 => 18.2.0
typescript: ^4.8.3 => 4.8.3
Describe the bug
TRPCProxyClient functions query, mutate and subscribe cannot be called trough the apply() method.
So you cannot pass the function to a library that call it later using apply (for example redux-saga call effect)
Error is :
TypeError: client[procedureType] is not a function
example is using this :
trpcProxyClient.greeting.query.apply(undefined, { name: "world" });
instead of :
trpcProxyClient.greeting.query({ name: "world" });
Link to reproduction
https://stackblitz.com/edit/github-zdwdjx?file=src/pages/index.tsx
To reproduce
Just use the stackblitz link, the bug is "active" by default
Additional information
It doesn't work, because the path variable in :
|
return createRecursiveProxy(({ path, args }) => { |
contains
["query", "apply"] instead of just
["query"]
So
clientCallType contains
"apply" and not
"query" at :
|
const clientCallType = pathCopy.pop()! as keyof DecorateProcedure< |
I think the only change to do it to check if apply is the last entry in path array and remove it ?
Thanks for help
👨👧👦 Contributing
Provide environment information
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 16.14.2 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 7.17.0 - /usr/local/bin/npm
npmPackages:
@tanstack/react-query: ^4.3.8 => 4.6.0
@trpc/client: ^10.14.1 => 10.14.1
@trpc/next: ^10.14.1 => 10.14.1
@trpc/react-query: ^10.14.1 => 10.14.1
@trpc/server: ^10.14.1 => 10.14.1
next: ^13.2.1 => 13.2.1
react: ^18.2.0 => 18.2.0
typescript: ^4.8.3 => 4.8.3
Describe the bug
TRPCProxyClient functions query, mutate and subscribe cannot be called trough the apply() method.
So you cannot pass the function to a library that call it later using apply (for example redux-saga call effect)
Error is :
TypeError: client[procedureType] is not a functionexample is using this :
trpcProxyClient.greeting.query.apply(undefined, { name: "world" });instead of :
trpcProxyClient.greeting.query({ name: "world" });Link to reproduction
https://stackblitz.com/edit/github-zdwdjx?file=src/pages/index.tsx
To reproduce
Just use the stackblitz link, the bug is "active" by default
Additional information
It doesn't work, because the path variable in :
trpc/packages/client/src/createTRPCClientProxy.ts
Line 117 in 5beba35
contains
["query", "apply"]instead of just["query"]So
clientCallTypecontains"apply"and not"query"at :trpc/packages/client/src/createTRPCClientProxy.ts
Line 119 in 5beba35
I think the only change to do it to check if apply is the last entry in path array and remove it ?
Thanks for help
👨👧👦 Contributing