LeonardoGentile / react-mobx-router5

React components for routing solution using router5 and mobx
MIT License
59 stars 5 forks source link

MobX 5 compatibility #9

Closed micros123 closed 5 years ago

micros123 commented 6 years ago

When installing MobX 5+, NPM will fire warnings of react-mobx-router5's dependencies because it requires ^4.0.0. Can this be adjusted to (also) be compatible with ^5.0.0 ?

npm WARN mobx-router5@4.2.1 requires a peer of mobx@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-mobx-router5@6.1.1 requires a peer of mobx@^4.0.0 but none is installed. You must install peer dependencies yourself.
LeonardoGentile commented 6 years ago

as I remember there are quite some breaking changes and incompatibility introduced by mobx 5 so I would need some time to review if they can affect the plugin.

Do you have some time to help?

micros123 commented 6 years ago

The changelog and breaking changes list is a lot shorter than it was for 3 -> 4. Looking at it, I doubt it could break a lot. But if you can point me in the direction of where you expect problems I might be able to have a look.

LeonardoGentile commented 6 years ago

still from memory, 4 was a release supposed to be a bridge to 5. Meaning it would offer the same things but being backward compatible, while 5 would only support modern browsers.

I might be wrong so looking at their doc would be the best

Dragomir-Ivanov commented 5 years ago

Hi there, Any progress on this? I get this when try to use:

TypeError: _this.router.hasPlugin is not a function
new RouteNode
node_modules/react-mobx-router5/dist/index.es.js:204
  201 | _this.routerStore = props[storeName];
  202 | ifNot(_this.routerStore, '[react-mobx-router5][routeNode] missing routerStore');
  203 | _this.router = _this.routerStore.router || null;
> 204 | ifNot(_this.router && _this.router.hasPlugin('MOBX_PLUGIN'), '[react-mobx-router5][routeNode] missing mobx plugin');
      | ^  205 | _this.state = {
  206 |   route: _this.routerStore.route
  207 | };

These are my deps:

   "react-mobx-router5": "^6.1.1",
    "react-router5": "^7.0.2",
    "mobx": "^5.8.0",
    "mobx-react": "^5.4.3",
    "mobx-router5": "^4.2.3",
    "router5": "^7.0.1",
    "router5-plugin-browser": "^7.0.1",
    "router5-plugin-logger": "^7.0.1",

Thanks.

Dragomir-Ivanov commented 5 years ago

It seems hasPlugin has been removed: https://router5.js.org/migration/migrating-from-6.x-to-7.x

LeonardoGentile commented 5 years ago

@Dragomir-Ivanov this has nothing to do with MobX, you are linking the router5 migration docs. This discussion is about Mobx (not router5) compatibility versions.

The problem you are having is because you installed a version of router5 not yet supported by this packages, at this time I only support router5 >= 6.1.2 (excluding 7+).

It is mentioned in the installation section.

LeonardoGentile commented 5 years ago

V. 6.2.0 now support the peer deps mobx >= 5 (not much changed on my side). Please notice that mobx 5 introduced some breaking changes and it will only work in environments providing native support for Proxy, here's the migration guide

Please let me if you find any trouble