Skip to content

Commit d3ca80a

Browse files
lluistfcsupasate
authored andcommitted
prevent POP actions to push the url into the history. (#76)
1 parent 28c8b68 commit d3ca80a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ node_modules
55
esm
66
lib
77
umd
8+
.idea
89
dist

src/ConnectedRouter.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const createConnectedRouter = (structure) => {
3838
} = history.location
3939

4040
// If we do time travelling, the location in store is changed but location in history is not changed
41-
if (pathnameInHistory !== pathnameInStore || searchInHistory !== searchInStore || hashInHistory !== hashInStore) {
41+
if (props.history.action === 'PUSH' && (pathnameInHistory !== pathnameInStore || searchInHistory !== searchInStore || hashInHistory !== hashInStore)) {
4242
this.inTimeTravelling = true
4343
// Update history's location to match store's location
4444
history.push({
@@ -92,6 +92,7 @@ const createConnectedRouter = (structure) => {
9292
listen: PropTypes.func.isRequired,
9393
location: PropTypes.object.isRequired,
9494
push: PropTypes.func.isRequired,
95+
action: PropTypes.string.isRequired,
9596
}).isRequired,
9697
basename: PropTypes.string,
9798
children: PropTypes.oneOfType([ PropTypes.func, PropTypes.node ]),

0 commit comments

Comments
 (0)