Giter VIP home page Giter VIP logo

Comments (19)

alisd23 avatar alisd23 commented on July 26, 2024 1

Try rm node_modules/react-router -fr && npm install

from mobx-react-router.

alisd23 avatar alisd23 commented on July 26, 2024 1

@JohnLouderback Yeah the react-router peer dependency should be enough to guarantee that history v3 is installed. Looks like history was upgraded to v4 somehow...

Either way glad it's working now!

from mobx-react-router.

alisd23 avatar alisd23 commented on July 26, 2024

No problem. So this package now requires react-router v3, which uses the new history package version. I think history.getCurrentLocation has been replaced by just history.location - https://github.com/mjackson/history#usage

from mobx-react-router.

optimatex avatar optimatex commented on July 26, 2024

i was trying to change history.getCurrentLocation to history.location() in mobx-react-router.js:268 but got similar error TypeError: history.location is not a function(…)
maybe my react-router package is not 3.0.0. npm list shows that i have +-- UNMET PEER DEPENDENCY [email protected] cuz in my package.json there is "react-router": "^3.0.0", and i put npm update [email protected]

from mobx-react-router.

alisd23 avatar alisd23 commented on July 26, 2024

Just checking the code history.getCurrentLocation will still work with v3. Yeah I think it's because you have react-router v2. I decided to only support v3 as there aren't really any major changes from v2, just bug fixes.

from mobx-react-router.

alisd23 avatar alisd23 commented on July 26, 2024

What version of this package have you got installed?

from mobx-react-router.

optimatex avatar optimatex commented on July 26, 2024

[email protected]

from mobx-react-router.

optimatex avatar optimatex commented on July 26, 2024

don't know how to update this UNMET PEER DEPENDENCY [email protected] cuz i did all standart npm update methods

from mobx-react-router.

optimatex avatar optimatex commented on July 26, 2024

i have used this rm node_modules/react-router -fr && npm install and now npm list --depth=0 shows [email protected]. It seems that problem is solved. Need to fix few more bugs from refactoring code and i'll notify very soon
Any way thank u for ur support!

from mobx-react-router.

alisd23 avatar alisd23 commented on July 26, 2024

No problem good luck πŸ‘

from mobx-react-router.

JohnLouderback avatar JohnLouderback commented on July 26, 2024

@alisd23 I'm having the same issue, however the steps above do not resolve the issue for me. I am seeing UNMET PEER DEPENDENCY [email protected] despite that module being installed and in the package.json. I even deleted a fresh installed all my node modules.

from mobx-react-router.

JohnLouderback avatar JohnLouderback commented on July 26, 2024

This may be relevant remix-run/history#402

Also, this is what I see on my history object:

image

from mobx-react-router.

alisd23 avatar alisd23 commented on July 26, 2024

@JohnLouderback Ah I didn't realise mobx released a new major version. This library still has a peer dependency on v2.5.2, so I wonder if that's the issue. I'll investigate.

from mobx-react-router.

alisd23 avatar alisd23 commented on July 26, 2024

Hmm History v3 definitely has getCurrentLocation on it. And react-router depends on history v3, so are you definitely using react-router v3?

from mobx-react-router.

JohnLouderback avatar JohnLouderback commented on July 26, 2024

npm list --depth=0 shows +-- [email protected] When I set a break point at the method call in the mobx-react-router module to getCurrentLocation That's where (as seen in the screenshot above) the history object does not have that method defined on it. Perhaps its something with the way I have everything initialized. Here's the module where the history object is set up:

import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { Router, browserHistory } from 'react-router';
import getRoutes from './routes';
import { Provider } from 'mobx-react';
import { observable, extendObservable } from 'mobx'
import { RouterStore, syncHistoryWithStore } from 'mobx-react-router';
import ApiClient from './helpers/ApiClient';

const clone = (obj : Object) : Object => JSON.parse(JSON.stringify(obj))
const client = new ApiClient();
const routingStore = new RouterStore();
const stores = window['stores'] = observable({
  ...clone(window['__data']),
  routes: routingStore
});
const history = syncHistoryWithStore(browserHistory, routingStore);

ReactDOM.render(
  <Provider {...stores}>
    <Router history={history}>
      {getRoutes(stores)}
    </Router>
  </Provider>,
  document.getElementById('content')
);

If there's anymore information I can provide you with to help troubleshoot the issue, let me know.

from mobx-react-router.

JohnLouderback avatar JohnLouderback commented on July 26, 2024

Ah, so when I run npm show history version it outputs 4.5.1. I wonder if the problem isn't that react-router is set up to install whatever the newest version is of the history module.

from mobx-react-router.

JohnLouderback avatar JohnLouderback commented on July 26, 2024

Okay, so that was in fact the issue. Running rm node_modules/history -fr && npm install [email protected] fixed the issue. I would say, it would good if this package has a fall forward for the latest history package.

from mobx-react-router.

rokoroku avatar rokoroku commented on July 26, 2024

@JohnLouderback Seems weird, react-router v3 has its own dependency as history ^3.0.0
(see react-router/package.json#L36)

The module history always have breaking changes in its major updates, so it's important to keep major version. Try to inspect if other dependencies install the latest version of the history module.

from mobx-react-router.

JohnLouderback avatar JohnLouderback commented on July 26, 2024

Thanks for the help!

from mobx-react-router.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.