Apollo link makes heavy use of zen-observable.
However ES2018 features async generators, aka async iterators, and it seems to me that they are a replacement for Observables, with less object-orientation smell.
Since Async generators are now a standard feature of javascript (and python, and C#, and others...), I believe apollo should be using those.
I understand that it would probably need breaking changes (or maybe it wouldn't ?), but I believe it would make sense in the longer term.
This is definitely something we are considering for Apollo Client 3.0! Not only does the Observable implementation require more code than async iterables, but the sometimes-sync/sometimes-async behavior of observables also leads to brittle code that sometimes requires await but not always.
Also, as a somewhat indirect argument in favor of async iterables, I would encourage anyone to try writing a function that converts an Observable to an async iterator, and then a function that does the opposite. One of those directions is much easier than the other!
Just saw the 2.6 release blog post mentions this, should we close ?
https://blog.apollographql.com/whats-new-in-apollo-client-2-6-b3acf28ecad1
Most helpful comment
This is definitely something we are considering for Apollo Client 3.0! Not only does the
Observableimplementation require more code than async iterables, but the sometimes-sync/sometimes-async behavior of observables also leads to brittle code that sometimes requiresawaitbut not always.