question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for defer/stream

See original GitHub issue

Raising this issue with goal of gathering feedback about Apollo “re-adopting” the defer/stream capability. There has been huge momentum in recent months around this. graphiql now supports defer/stream out of the box and houses a sample implementation for this. We are also seeing leaps being made over in the spec https://github.com/graphql/graphql-spec/pull/742 So its only a matter of time before this will become an expected feature.

I know that this is scheduled for 3.5; but wondering If this is something that I can help contribute back across the line? I gave this is a fair crack over at apollo-link-multipart using meros so have had some experience in adding it. But believe adding this into the core would enable greater adoption.

Links~

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:22
  • Comments:20 (10 by maintainers)

github_iconTop GitHub Comments

10reactions
benjamncommented, Mar 26, 2021

@maraisr Sorry for leaving you hanging for so long here!

As long as the incoming data payloads get written into the InMemoryCache, all queries and fragments that are watching the cache will be notified automatically of the new data. This could either mean writing the entire result multiple times, with incremental patches applied, or somehow writing only the data that have changed. The latter approach might be more efficient, but trickier. I would prefer for it to work without relying on the label, but I see how label could help.

I think we will end up introducing a new NetworkStatus.partial enum value to indicate that a query result is still missing some deferred parts. The NetworkStatus concept is something that exists in ApolloClient outside of ApolloLink, so I don’t think we can terminate everything within ApolloLink.

While I hope that answers at least some of your questions, and I very much appreciate you sharing your branch as a proof of concept, I have to warn you that we (the core team) will probably have an easier time navigating the internals of Apollo Client than you (our fault, not yours), so it might make sense to hold off on a full PR, to protect your personal time. We will look for a ways to use meros (thanks for that), and I will definitely be reaching out to you for your review, when we have something ready for review/testing.

Scheduling-wise, this is a priority for the v3.5 release (I got it moved up from v3.6), so I hope you won’t be waiting long. Thanks again for going above and beyond to get the ball rolling on this project.

9reactions
hwillsoncommented, Mar 30, 2021

Let’s re-open this for tracking (we’re aiming to have this in @apollo/client@3.5).

Read more comments on GitHub >

github_iconTop Results From Across the Web

New features in GraphQL: Batch, defer, stream, live, and ...
This is a proposal for a new directive called defer, which is intended to minimize the time to first data. When you have...
Read more >
Improving Latency with @defer and @stream Directives
... with @defer / @stream to be HTTP with chunked transfer encoding. ... It has low overhead, has been supported by browsers for...
Read more >
Defer and Stream – GraphQL Yoga
Enabling support for the @defer and @stream directive requires ... { useDeferStream } from '@graphql-yoga/plugin-defer-stream' const typeDefs ...
Read more >
Documentation - SolidJS · Reactive Javascript Library
T; name?: string; deferStream?: boolean; ssrLoadFrom?: ... Store objects support the use of getters to store calculated values.
Read more >
GraphQL Pro - Defer - Stream
0 and requires GraphQL-Ruby 1.13.6+. Installation. To support @stream in your schema, add it with use GraphQL::Pro::Stream :.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found