T
tRPC

extra json property added after data when consuming a query hook.

extra json property added after data when consuming a query hook.

AEAhmed Eid9/20/2022
I have this issue where when consuming a RQ hook there is an extra json object that I have to use to access the data & it does not exist on the type.
AEAhmed Eid9/20/2022
I have to use version.data?.json.version when typescript suggest version.data.version which is always undefined. I'm using version TRPC v10.
UUUnknown User9/20/2022
Message Not Public
Sign In & Join Server To View
AEAhmed Eid9/20/2022
AEAhmed Eid9/20/2022
AEAhmed Eid9/20/2022
router ^^ @oscartbeaumont any idea what could I've done wrong ?
UUUnknown User9/20/2022
Message Not Public
Sign In & Join Server To View
AEAhmed Eid9/20/2022
thanks cc @alex / KATT
UUUnknown User9/20/2022
Message Not Public
Sign In & Join Server To View
AEAhmed Eid9/20/2022
I understand. I figured out the issue I have to use the same transformer on both the client and the server. I was using superjson on the server but not on the client.
UUUnknown User9/20/2022
Message Not Public
Sign In & Join Server To View
AEAhmed Eid9/20/2022
yeah, I'm unable to get superjson to work with react native. Unable to resolve "copy-anything" from "../../node_modules/superjson/dist/index.js" getting this error, do u have any idea how I might be able to fix it ?
AKAlex / KATT 🐱9/20/2022
yeah, you likely haven't setup superjson on both sides i can't debug why superjson isn't working in RN for you you could disable it
AEAhmed Eid9/20/2022
Disabled it and it’s working fine.
DDani;9/20/2022
Seems like it's a known issue with superjson, take a look here: https://github.com/blitz-js/superjson/issues/190
AKAlex / KATT 🐱9/20/2022
why the hell does a package like superjson need a subdep facepalm someone please make an alternative https://github.com/blitz-js/superjson/issues/85 https://github.com/blitz-js/superjson/issues/87
DDani;9/21/2022
apparently that copy-anything package (+ it's subdependency) is under 80 LOC πŸ™‚

Looking for more? Join the community!

T
tRPC

extra json property added after data when consuming a query hook.

Join Server