supasate / connected-react-router

A Redux binding for React Router v4
MIT License
4.73k stars 593 forks source link

push not working #447

Open harshitshah27 opened 4 years ago

harshitshah27 commented 4 years ago

Push is changing the URL but not redirecting actually to the url

Revinand commented 4 years ago

I've got the same problem when installed version 5.0 of the history package. Downgrading to the version 4.10.1 helped me.

https://github.com/ReactTraining/history/issues/803 https://github.com/ReactTraining/history/issues/804

lpakula commented 4 years ago

I'm also having the same issue with history@4.10.1

URL is changing but it's not really redirecting (eg. staying on Login page)

"history": "4.10.1",
"connected-react-router": "6.8.0",
"react-router-dom": "^5.2.0",
"react-redux": "^7.2.1",
"redux": "^4.0.5",

I'm running development server

yarn --version
1.13.0

if i use dispatch(go("/")) instead of dispatch(push("/")) i get redirected correctly, however, it's obviously refresing the page

Any ideas? what other dependency might cause the conflict ?

lpakula commented 4 years ago

Ok, i resolved my problem as described in https://github.com/supasate/connected-react-router/issues/417

tibic commented 3 years ago

@lpakula dispatch(go("/")),我这里显示go的类型是number,不是字符串

tibic commented 3 years ago

push后再dispatch(go(0))

low-ghost commented 3 years ago

The exact problem is in fact described in #417 and solved there. Pasting my comment there for visibility here, since it was definitely hard to track this one down.

<Provider store={store}>
  <ConnectedRouter history={history}>
    <Router>
      <App />
    </Router>
  </ConnectedRouter>
</Provider>

should be

<Provider store={store}>
  <ConnectedRouter history={history}>
    <App />
  </ConnectedRouter>
</Provider>

Not sure if the nested Router is entirely unintended or vestigial of an older version's intended setup, but killing it fixes the issue of URL changing on <Link to="/path" /> or useHistory().push("/path") but the app not registering or rendering any changes