Mayhul
Mayhul2w ago

Migrating to use Superjson

I currently have a tRPC router that is being used by a web app & React native client. My current version does not use superjson. I want to start using superjson as my transformer. Is there an easy way for me to make this migration? When I tried just starting to use Superjson, our React native client started running into errors because the old mobile client was not using superjson but the server was. I wish I could access context in my transformer so I could choose to only do the transformation for new clients. Any other ideas on how I can make the switch-over while maintaining backwards compatibility for older clients?
4 Replies
Alex / KATT 🐱
I don't know a painless way of doing it as it can't be conditionally enabled/disabled maybe you just need to spin up endpoints for the old clients that doesn't use superjson or force update all clients
Mayhul
MayhulOP2w ago
If I'm merging multiple routers together, is there a way for me to apply the superjson transformer to just 1 router?
Alex / KATT 🐱
no
Nick
Nick2w ago
Honestly sounds like a situation to have a load balancer which checks the app version via headers/useragent and a second deployment without the transformer in place

Did you find this page helpful?