Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Does not recognized Observable as result when Observable is from an other RxJS version #5

Closed
alexstrat opened this issue Jan 18, 2019 · 5 comments
Labels

Comments

@alexstrat
Copy link
Contributor

I have a project that uses reactive-graphql and a different version of rxjs. The resolvers that uses other version of rxjs are not recognized as an observable.

Probably because of this line. I'd say we should rather use rxjs.isObservable.

DanielMSchmidt pushed a commit that referenced this issue Jan 21, 2019
@alexstrat
Copy link
Contributor Author

alexstrat commented Jan 21, 2019

I realised that the rxjs version issue is larger:

I have a project using rxjs5. rxjs6 being a peerDependency of reactive-graphql, rxjs6 was not installed, npm (discretly) warned me about unmet peer dependency and, at runtime, reactive-graphql tried to use rxjs5t but messed up with imports.

So actually, even with using isObservable, theoretically*, it is not be possible to use rxjs5 with reactive-graphql.

* I was able to get rxjs5 and rxjs6+reactive-graphql when I opened this issue by manually installing rxjs6 in node_modules/reactive-graphql, but this is not a viable and clean solution.

A solution to use rxjs5 side by side with reactive-graphql would be (in addition to use rxjs.isObservable) to declare rxjs6 as a dependency of reactive-graphql. Is there any side-effect with moving rxjs to dependencies instead of peerDependencies?

@DanielMSchmidt
Copy link
Contributor

I misunderstood the issue and thought you were talking about minor versions.

Is there any side-effect with moving rxjs to dependencies instead of peerDependencies?

There are two side effects

  1. There will be two different versions of rxjs installed, so require calls in this project will resolve version 6 and those outside will resolve 5, leading us to the second problem
  2. RxJS 5 and 6 can not be used side by side. An observable from version 6 can not be used in an app using version 5, there is a breaking change in their entire API design

I would advice to use rxjs compat with rxjs 6 in your project

@DanielMSchmidt
Copy link
Contributor

As this is no problem in this project, I'll close the issue. Feel free to reopen

DanielMSchmidt pushed a commit that referenced this issue Jan 22, 2019
@mesosphere-frontend-ci
Copy link

🎉 This issue has been resolved in version 3.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@alexstrat
Copy link
Contributor Author

Yes, I think I'll just move to rxjs6 indeed

Could have been cool if the APIs were independent of any Observable implementation as soon as user provides Observables that follow the standard. But no idea if it's possible and that's an other topic anyway..

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

No branches or pull requests

3 participants