Repository navigation
Remove networkInterface for ApolloLink - #1993
Conversation
|
@jbaxleyiii, thanks for your PR! By analyzing the history of the files in this pull request, we identified @Poincare, @helfer and @lewisf to be potential reviewers. |
evans
left a comment
There was a problem hiding this comment.
This looks great! Couple changes for Deduplicator and then we should be good to go!
| this.networkInterface = networkInterface; | ||
| this.deduplicator = new Deduplicator(networkInterface); | ||
| this.link = link; | ||
| this.deduplicator = new Deduplicator(link); |
There was a problem hiding this comment.
Deduplicator should accept an Apollo Link. Could be this PR or next
There was a problem hiding this comment.
@evanshauser so I totally had it locally and forgot to commit it haha
There was a problem hiding this comment.
Would moving the deduplicator into a Link be part of 2.0? It seems pretty decoupled so it might be easy.
| */ | ||
| public subscribe(options: SubscriptionOptions): Observable<any> { | ||
| this.initQueryManager(); | ||
| // public subscribe(options: SubscriptionOptions): Observable<any> { |
| } | ||
| }; | ||
| } | ||
| // public subscribeToMore(options: SubscribeToMoreOptions): () => void { |
| this.networkInterface = networkInterface; | ||
| this.deduplicator = new Deduplicator(networkInterface); | ||
| this.link = link; | ||
| this.deduplicator = new Deduplicator(link); |
There was a problem hiding this comment.
Would moving the deduplicator into a Link be part of 2.0? It seems pretty decoupled so it might be easy.
| .then(result => { | ||
| const observable = execute(this.link, request); | ||
| return new Promise((resolve, reject) => { | ||
| makePromise(observable) |
There was a problem hiding this comment.
Why not just return this promise directly instead of wrapping in new Promise?
There was a problem hiding this comment.
Its for the nested reject state to capture errors and pass them to catch. I think we should change this
There was a problem hiding this comment.
OK, flag for discussion then
There was a problem hiding this comment.
@stubailo I'm going to implement the new error portion on a follow up PR
| } as Subscription; | ||
| }); | ||
| } | ||
| // public startGraphQLSubscription( |
| use(middlewares: NetworkMiddleware): HTTPNetworkInterface, | ||
| useAfter(afterwares: NetworkAfterware): HTTPNetworkInterface, | ||
| query(request: Request): Promise<ExecutionResult> | ||
| query(request: Request): Promise<ExecutionResult>, |
There was a problem hiding this comment.
This is odd - do we have misconfigured Prettier somewhere? It's a good change, but seems to be a configuration smell
There was a problem hiding this comment.
hmm, yeah thats odd
| // Turn off warnings for repeated fragment names | ||
| graphqlTagDisableFragmentWarnings(); | ||
|
|
||
| import './ApolloClient'; |
There was a problem hiding this comment.
Lol these are alphabetized now? Did you do that manually or is there some tool?
There was a problem hiding this comment.
vscode cmd + shift + p; sort lines
| query: DocumentNode; | ||
| variables?: Record<string, any>; | ||
| operationName?: string; | ||
| operationName?: string | null; |
There was a problem hiding this comment.
Doesn't the ? already cover null?
There was a problem hiding this comment.
nope! its undefined | string instead of undefined | string | null
|
Lerna / npm / WSL is giving me problems and its past 1 here so I'm going to finish this in the morning |
Generated by 🚫 dangerJS |
|
@stubailo @evanshauser this is ready for another look but evans and I just realized we had our wires crossed on how subscriptions would be changing. @stubailo I'm not familiar enough with subscriptions, if you have some time would you look this over. The basic idea is to remove the |
| export type Subscription = ZenObservable.Subscription; | ||
| export type Observer<T> = ZenObservable.Observer<T>; | ||
| export type Subscriber<T> = ZenObservable.Subscriber<T>; | ||
| export type ObservableLike<T> = ZenObservable.ObservableLike<T>; |
There was a problem hiding this comment.
These are now exported directly from ZenObservable if it makes sense to use export * from 'zen-observable-tx
| @@ -1,6 +1,12 @@ | |||
| import Observable from 'zen-observable-ts'; | |||
| import Observable, { ZenObservable } from 'zen-observable-ts'; | |||
There was a problem hiding this comment.
Does it make sense to include apollo-link in the monorepo?
I think we will eventually want to. Now might be a little premature
This PR removes the current transport stack (networkInterface, batched, etc) in favor of supporting the first run of ApolloLink. It is focused on adjustments to query manager and associated tests.
This PR does not support returning multiple results from a link. That will be in a follow up PR.
Checklist:
Breaking Changes:
observer.errorshould setclosedto true on the observer prevent further calling. This test shows an error happening, thenobserver.nextgetting information and passing it through toupdateQuerycc @evanshauser