-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: subscription procedure should use onData, not onNext #26
base: main
Are you sure you want to change the base?
fix: subscription procedure should use onData, not onNext #26
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good to me. I wonder if anyone else can review too.
So, if this fixes a bug, has there been an API change?
Yeah, somewhere between trpc 9 and 10. Here is the same example implementation in version 9, which uses By the way, would it be helpful if I added a new example to this pr that uses subscriptions and websockets (and potentially httpSubscriptionLink later)? It looks like this feature is in for a roller coaster in the near future. |
Aright, that's wild. Anyway, I think the fix is good. Thanks for your help! By the way, this repo is looking for a maintainer. Would you be interested in taking care of it? |
I could be. I think this stack has a lot of potential for realtime apps and multiplayer games, which I'm currently exploring, so I'll be keeping an eye on this for a while regardless. Maintaining a public repo would be something new for me, but this one seems pretty straightforward. |
That's great! I'll invite you to the repo later, and my suggestion for you are to:
|
I referenced the implementation of the vanilla trpc client here since the v10 docs are light on the topic.
In a barebones vite project, without this fix any components using
atomWithSubscription
will be in suspense indefinitely without any noticeable error. This is with@trpc/[email protected]
. I imagine this could all go out the window with v11.