You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a race condition that causes incorrect data to be returned if there are two different clients. I have two different TRPC clients. The first is a regular client.
I can use the regular client in components, doing things like const result = trpc.path.getData.useQuery(). The proxy client is used in TanStack Router route loaders, as it can be awaited.
There is a race condition that causes incorrect data to be returned if there are two different clients. I have two different TRPC clients. The first is a regular client.
The second is a proxy client.
I can use the regular client in components, doing things like
const result = trpc.path.getData.useQuery()
. The proxy client is used in TanStack Router route loaders, as it can beawait
ed.This causes an issue because the two TRPC clients cause there to be two instances of
onMessage
.electron-trpc/packages/electron-trpc/src/renderer/ipcLink.ts
Lines 44 to 46 in a386c98
Each
electron-trpc
client will have a separate requestOperation
id
.https://github.com/trpc/trpc/blob/48de686d22ccbefe1cf97eaa7f205dabe7302d2a/packages/client/src/internals/TRPCUntypedClient.ts#L79-L88
Thus, it is possible for the wrong data to be returned in some circumstances. Consider the following:
requestId = 0
. AnonMessage
handler is added.requestId = 0
. AnonMessage
handler is added.requestId = 1
.requestId = 1
.onMessage
callback trigger withid = 1
.onMessage
was called withid = 1
, and so it returns incorrect data back to the caller.#handleResponse
has already been run on incorrect data. The correct response is discarded.The text was updated successfully, but these errors were encountered: