Open dylanbhughes opened 5 years ago
I'm actually needing the exact same thing.
👍 Will attempt
Does this mean $apollo.loading does not work when u use sockets at all?
That's been my experience @rnenjoy
Do you have any guidance on a workaround for this? For example, I need to know when all the subscriptions finish the first load so I can show the view, otherwise, I should display a global loading banner. I thought I can use the "this.$apollo.subscriptions.subscriptionName.starting" of all the subscriptions to show a loading banner, what do you think about this?
This is a very specific feature request, so I'll preface this by saying I'm intending on PRing this myself. This issue is to give the core team a place to say "we don't want to support that because x".
My team is currently using Hasura for services and Apollo Server for our API gateway. We stitch our schema in Apollo. One of the great features that Hasura provides is automatic subscriptions for all tables in our DB. This means that subscriptions send information over websocket instead of just indicating a change to a specific piece of data. Because our data changes very rapidly and up-to-the-second information is important to our users, we've decided to use subscriptions for everything.
Because we're going with this approach, we run into a problem detecting "loading" states when reactive variables change for a subscription.
Desired behavior:
this.$apollo.subscriptions.subscriptionName.loading = true
until a new response is received.this.$apollo.subscriptions.subscriptionName.loading = false
after a new response.Currently, there is only a
this.$apollo.subscriptions.subscriptionName.starting
indicator.If the feedback here is "you should be doing this outside of
vue-apollo
I'm fine with that too. But, if anyone else thinks this would be useful (or if no one tells me not to) I'd like to take a crack at it.