Skip to content
This repository has been archived by the owner on Jul 10, 2019. It is now read-only.

Doesn't work with subscriptions properly #249

Open
DmitryVlaznev opened this issue May 18, 2018 · 2 comments
Open

Doesn't work with subscriptions properly #249

DmitryVlaznev opened this issue May 18, 2018 · 2 comments
Assignees

Comments

@DmitryVlaznev
Copy link

DmitryVlaznev commented May 18, 2018

When I use apollo-link-state and a client-only field with a @client directive which is mixed with subscription data as described here (a value actually comes from state link defaults), apollo-link-state unsubscribes a subscription silently after the first response.

I found the following code into the index.ts file:

.then(nextData => {
  observer.next({
    data: nextData,
    errors,
  });
  observer.complete();
})

When I replaced this code with the followed one

.then(nextData => {
  observer.next({
    data: nextData,
    errors,
  });
  if (type !== 'Subscription') {
    observer.complete();
  }
})

a subscription starts working as expected.

@DmitryVlaznev
Copy link
Author

DmitryVlaznev commented Jun 5, 2018

I tried to use this patch above (built a package from a master branch) but got an error:

TypeError: obs.flatMap is not a function

I've realized that it is more than likely that one of the links in the links chain returns ObservableLike object instead of an Observable.

@hwillson
Copy link
Member

Related to #138.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants