Connected-react-router: Broken browser back button behavior

Created on 21 Feb 2019  路  6Comments  路  Source: supasate/connected-react-router

Store updates from history.listen break browser back behavior, causing user to ping-pong between 2 routes.

Steps to reproduce:

  1. User visits /home ->/hello -> /counter
  2. On /counter, clicks browser back and lands on /hello
  3. On /hello clicks browser back

Expected behavior: lands on /home
Actual behavior: lands on /counter

GIF Illustration:
ping pong

Branch that reproduces issue is available here: https://github.com/kswin/connected-react-router/tree/poc/broken-browser-back

Most helpful comment

Is this going to be fixed? still an issue, even without time travel

All 6 comments

Similar behavior was described in #76, but this happens independently of time travel for me

+1

+1

Is this going to be fixed? still an issue, even without time travel

Is there a work around i can implement, until the PR is merged ?

Well, I did fork this project and made time travel optional. That was the bit of code that caused the bug -> https://github.com/kswin/connected-react-router

// in package.json
 "connected-react-router": "github:kswin/connected-react-router"

// from your routes file
<ConnectedRouter history={reactHistory} hasTimeTravel={false}>

For the exact code change to the source see src/ConnectedRouter.js in PR
https://github.com/kswin/connected-react-router/pull/3/files

It's a long PR, but that's because most files are just the distribution

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hauptrolle picture hauptrolle  路  3Comments

alamchrstn picture alamchrstn  路  5Comments

tonoslav picture tonoslav  路  4Comments

alexseitsinger picture alexseitsinger  路  3Comments

jhwheeler picture jhwheeler  路  3Comments