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
If you have trpc configured with a custom transformer, the transformer is not called on emitted data from the router. The receiving end calls deserialize resulting un undefined edited data from the subscription.
The example below uses superjson and the onData of the subscription will return undefined because the receiving end is expecting the data to be serialized with the provided transformer.
// backgroundconstt=initTRPC.create({transformer: superjson});constappRouter=t.router({echoSubscription: t.procedure.input(z.object({payload: z.string(),date: z.date()})).subscription(({ input })=>observable<typeofinput>((emit)=>{emit.next(input);}),),});// content scripttrpc.nestedRouter.echoSubscription.subscribe({payload: 'subscription1',date: date1},{onData: (data)=>{// data will be undefined here}})
The text was updated successfully, but these errors were encountered:
firemuzzy
changed the title
Bug: subscription route not applying transformer to edited data
Bug: subscription route not applying transformer to emited data
Nov 20, 2023
firemuzzy
added a commit
to LabCo/trpc-chrome
that referenced
this issue
Nov 20, 2023
firemuzzy
changed the title
Bug: subscription route not applying transformer to emited data
Bug: subscription route not applying transformer to emitted data
Nov 20, 2023
If you have trpc configured with a custom transformer, the transformer is not called on emitted data from the router. The receiving end calls
deserialize
resulting un undefined edited data from the subscription.The example below uses superjson and the
onData
of the subscription will return undefined because the receiving end is expecting the data to be serialized with the provided transformer.The text was updated successfully, but these errors were encountered: