apollographql / apollo-feature-requests

🧑‍🚀 Apollo Client Feature Requests | (no 🐛 please).
Other
130 stars 7 forks source link

Change useSubscription to be Suspense compatible #428

Open c10b10 opened 8 months ago

c10b10 commented 8 months ago

I'm working on a real-time data heavy application and we'd like to integrate our subscriptions with Suspense.

Due to reasons having to do with uncertainty around race conditions we:

We'd like to make this Suspense compatible but currently there's no way of capturing the subscription in a Promise. We'd need the be able to call a version of useSubscription in a promise and resolve the promise only when the READY event is detected.

Is anything like that planned or could I maybe do this some other way with the current API?

jerelmiller commented 8 months ago

Hey @c10b10 👋

Thanks for the request! This is certainly something we've seen come up before and we are certainly open to the idea! I can't promise a timeline, but appreciate the feature request so that we can gauge interest 🙂