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

useSubscription does not conform to Apollo #759

Open
objectiveSee opened this issue Nov 2, 2023 · 2 comments
Open

useSubscription does not conform to Apollo #759

objectiveSee opened this issue Nov 2, 2023 · 2 comments

Comments

@objectiveSee
Copy link

The useSubscription hook using the AppSync link does not work correctly. Specifically, it does not implement the onComplete event which is defined by Apollo documentation. You can reproduce this by simply adding an onComplete handler to any subscription. This is important because there is no other way know when the subscription has been established. It would be nice to send this event.

I can try to make these changes if somebody could point me in the correct direction in the codebase.

Example:


  const { data, loading, error } = useSubscription<TData, TVariables>(
    subscription,
    {
      variables,
      onError,
      onComplete: () => {
        console.log('😵😵😵😵😵😵😵😵😵'); // <---- this never gets called :/ 
      }
    }
  );
@Bloodyaugust
Copy link

This issue was a major pain to find, after digging through so much documentation on the Apollo side (and the dearth of docs for this project). I need to know when it's okay to send mutations when my logic depends on receiving the update from this subscription. To do that, I need onComplete. In the meantime, I'm going to have to make my mutation idempotent and re-send it until I see a message come back.

@objectiveSee
Copy link
Author

That sounds like a very similar problem. I also noticed that the loading property doesn't really tell us anything in this scenario. It would be great to hear from one of the Amazon engineers who is supporting this project. 🧐

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

No branches or pull requests

2 participants