Using superjson transformer makes data empty
Hi!
I've been developing using trpc for the past month or so. It's been a smooth sail so far. Suddenly now the
.data
property on trpc queries are empty.
Checking the network tab the data is definitely there in the response, it's just undefined
when accessing query.data
. After some time debugging, I removed the superjson
transformer from client & server, and now things are working again.
Unfortunately it also means I lack native objects (like Date
).
Version: 11.0.0-rc.553
2 Replies
superjson
is superannoying
- with ChatGPT its easy to create your own serializers. if you want to see what that looks like, I just added them to my growing library of utils: https://github.com/arken-engineering/node/blob/main/util/rpc.ts#L31-L106superjson
serializes the payload into two subkeys json
and meta
. if json
key is not present in your payload, it can not deserialize it and returns undefined
. just create a custom transformer to account for that.
assign this transformer
in