n1ru4l/graphql-live-query

[Question] How to use jsondiffpatch with apollo-client?

tetchel opened this issue · 1 comments

I don't understand how the example in the readme is meant to be applied to a project which uses apollo-client.

What is networkLayer ? It seems like I should be adding a link which runs after the websocket transport link.

Hey @tetchel, pardon the bad documentation. 😭

I quickly created a PR for showcasing usage with patches using apollo-client: #950

The patch middlewares are built around AsyncIterables, thus you first need to convert the EventSource into an AsyncIterable, then apply the patch transforms and last apply the async iterable to the Observable sink.

Of course, this process would be more straightforward if all the GraphQL clients did not decide to use their own "stream"-like structure and instead use JavaScript native structures (AsyncIterable). Anyways that is just me ranting a bit. 😁