Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

david-bell-brown
Copy link
Collaborator

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.

Copy link

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.

Copy link
Member

@dai-shi dai-shi left a 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?

@david-bell-brown
Copy link
Collaborator Author

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 onNext. It also looks like it might have briefly been next before it was updated to onData here.

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.

@dai-shi
Copy link
Member

dai-shi commented Dec 27, 2024

Yeah, somewhere between trpc 9 and 10. Here is the same example implementation in version 9, which uses onNext. It also looks like it might have briefly been next before it was updated to onData here.

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?

@david-bell-brown
Copy link
Collaborator Author

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.

@dai-shi
Copy link
Member

dai-shi commented Dec 27, 2024

That's great!
I'm fine to let you fully maintain it, but if you feel nervous for doing something new, I can still help keeping eye on it.

I'll invite you to the repo later, and my suggestion for you are to:

  • configure watching this repo for all activities,
  • and, if you have a Discord account, join my server so that we can also communicate there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants