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

Version 6.1.0 is broken #220

Closed
ahce opened this issue Dec 31, 2018 · 14 comments
Closed

Version 6.1.0 is broken #220

ahce opened this issue Dec 31, 2018 · 14 comments

Comments

@ahce
Copy link

ahce commented Dec 31, 2018

  • The action LOCATION_CHANGE is called after componentDidMount of the component, this causes my sagas to be canceled.
    I use redux-saga and cancel them with LOCATION_CHANGE.

v6.1.0
image
v6.0.0
image

  • goForward is totally broken.
    never enabled
    image
@supasate
Copy link
Owner

supasate commented Jan 1, 2019

For the LOCATION_CHANGE calling after componentDidMount, this is intended to fix the old implementation by moving the dispatching from constructor to componentDidMount. (see this comment.

For the goForward, can you explain a bit more? Is there any minimal repo to reproduce it?

@ahce
Copy link
Author

ahce commented Jan 1, 2019

@supasate Thanks for your reply!
The repo
Use this extension for test the sagas and actions.

@syjstc
Copy link

syjstc commented Jan 4, 2019

Got similar problem here, but backward. The problem is caused by the listeners of react-router's history and the subscriber of redux store.

Router component from react-router will listen to history in componentWillMount. (v 4.3.1 used by latest connected-react-router).
But ConnectedRouter will do that in componentDidMount instead of constructor.
The order of these listeners are changed in 6.1.0.
Also, ConnectedRouter subscribes to redux store. It will check history path with store path.

Here is an example when browser backward is clicked:
The listener of router component will be triggered first. That will update it's state. Then children components might be updated, and fire some redux actions (from componentDidUpdate or others). Because redux executions are sync, so store could be changed, then subscribers will be triggered first before the history listener of ConnectedRouter. In that case, LOCATION_CHANGE won't be fired the first time when a history is changed. But according to the subscriber, store path is still the old one. So a new history.push will be fired. That's really unexpected.

@ryank311
Copy link

ryank311 commented Jan 4, 2019

We saw really odd behavior as well in our application when upgrading to the latest version. We had two pages, both with back buttons and we would somehow get into a circular loop.

  1. Page 0, click a link to Page 1
  2. Page 1, click a link to Page 2
  3. Page 2, click a button that calls (back) and navigate to Page 1
  4. Page 1, click a button that calls (back) and navigate to Page 0

Works fine on version 6.0.0, but on version 6.1.0, step 4 actually gets sent to Page 2 instead of Page 0. For now, we have reverted to the older stable version.

@supasate
Copy link
Owner

supasate commented Jan 5, 2019

@ahce @syjstc @ryank311 Can you all try again with connected-react-router@next (6.2.0-beta.1) if it solves the problem?

@ahce
Copy link
Author

ahce commented Jan 5, 2019

@supasate Thanks, now it's fixed for me.
Tested here

@simontong
Copy link

@supasate - That fixed it for me too, thanks

@novembrea
Copy link

Wew, thought it was something on my end, spent couple of hours digging through the code. Upgrading to a current 6.2.0-beta.3 solved it. Much appreciated.

@chrispaynter
Copy link

Thank you for this fix, 6.2.0-beta.3 has saved my sanity.

@harrygreen
Copy link

We had the same issue - 6.2.0-beta.3 has solved it. Thanks @supasate!!

@ValentinH
Copy link
Contributor

Same here, 6.2.0-beta.3 fixed it :)

@ajur58
Copy link

ajur58 commented Jan 10, 2019

Had the same issue where components were mounted twice after history.push, lost 1/2 day debugging, 6.2.0-beta.3 fixes it. Thank you!

@chrispaynter
Copy link

I think this fix is important enough to get published into NPM with a hot fix.

@supasate
Copy link
Owner

v6.2.0 has been released :)

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

10 participants