Apollo client useSubscription hook is loading forever. How do I troubleshoot this?

I followed every single step in this article.

But my useSubscription hook has the status of loading=true forever, and no data is being displayed. I am not sure where to start troubleshooting this problem.

Below is how I setup my client, and how I’m using the hook.

Any help is greatly appreciated. Thank you!

Hi. It’s not necessary to create own useApolloClient hook, just import

import { useApolloClient } from '@apollo/client';

In @apollo/client 3.5.6 loading changes.

Thank you for your response!

I don’t think my hook works the same way as the useApolloClient hook; it just has the same name. Anyways, so simplify my App.tsx code, I have removed the useApolloClient hook portion, and did this instead. No change in functionality, and am still experiencing the same issue.

const client = new ApolloClient({
    cache: new InMemoryCache(),
    link,
  });

return <ApolloProvider client={client}>...</ApolloProvider>

Any help would be greatly appreciated. Thank you!

Take a look codesandbox. It’s from examples. Loading changes from true to false