Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea: Add option to disallow multiple Mobx versions at the same page #1098

Closed
3 tasks done
jhuiting opened this issue Jul 14, 2017 · 5 comments
Closed
3 tasks done

Idea: Add option to disallow multiple Mobx versions at the same page #1098

jhuiting opened this issue Jul 14, 2017 · 5 comments
Milestone

Comments

@jhuiting
Copy link

jhuiting commented Jul 14, 2017

Idea:

  • What problem would it solve for you? We ran into issues last week because two versions of Mobx were running on the same page. We'd like to just throw an error if that's the case to make sure the versions in sync.
  • Do you think others will benefit from this change as well and it should in core package (see also mobx-utils)? Yes, can imagine that some people ran into the same problems. Might also be that people need multiple versions, hence the introduction of a switch to opt-in on this.
  • Are you willing to (attempt) a PR yourself? Yes, no problem.

So when this option is set in the Mobx config it will throw an error instead of the warning you'd currently get.

@iamdanthedev
Copy link

3.2.0 introduced a warning about multiple instances, according to docs

@jhuiting
Copy link
Author

Yes, see also the last line of my issue ;-) I'm proposing now to optionally make that an error.

@mweststrate mweststrate modified the milestone: 4.0 Sep 18, 2017
@mweststrate
Copy link
Member

I'll think there are already too much options around sandboxing / non sandboxing, sharing state etc as it is. I'm fine by printing an error instead of a warning to the console. Actually throwing however sounds as a breaking change, which we could do in the 4.0 release.

@phiresky
Copy link
Contributor

This issue also occurs when doing this:

import { observable } from "mobx/lib/mobx";

import { observable as o2 } from "mobx";

console.log(observable === o2);

when using es6 modules. The problem is that the VS Code autofix for importing missing variables does the first import, which imports a second copy (mobx.js) while from "mobx" loads mobx.module.js

@mweststrate
Copy link
Member

From Mobx and upward 4 this will be an error, so closing the issue here :)

@mweststrate mweststrate mentioned this issue Feb 27, 2018
38 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants