Skip to content
This repository has been archived by the owner on Oct 26, 2018. It is now read-only.

Causes reactRouter onUpdate to be double invoked #108

Closed
tomatau opened this issue Dec 10, 2015 · 8 comments
Closed

Causes reactRouter onUpdate to be double invoked #108

tomatau opened this issue Dec 10, 2015 · 8 comments

Comments

@tomatau
Copy link
Contributor

tomatau commented Dec 10, 2015

When redux-simple-router is setup and a path is updated through a Link or IndexLink from react router, the Router.onUpdate method is double invoked.

If pushPath or updatePath is used, the onUpdate behaves normally.

Here's a branch where it's happening for me
onUpdate handler:
https://github.com/tomatau/breko-hub/blob/versionUpdates/src/app/entry.js#L33

integration:
https://github.com/tomatau/breko-hub/blob/versionUpdates/src/app/state/store.js#L23

navigation:
https://github.com/tomatau/breko-hub/blob/versionUpdates/src/app/components/containers/HeadNavigation.js#L23

@kimjoar
Copy link
Collaborator

kimjoar commented Dec 10, 2015

Thanks, @tomatau. Seeing the same in my app when I add a console.log to onUpdate. I'll take a look and see what I find.

@kimjoar
Copy link
Collaborator

kimjoar commented Dec 10, 2015

I've got a failing test, looking for a solution that doesn't break other stuff.

@kimjoar
Copy link
Collaborator

kimjoar commented Dec 10, 2015

@tomatau I found a solution and created a PR. I'll have to think a bit more on it as I'm not entirely sure about the implementation, but hopefully we should have a fix soon.

@kimjoar
Copy link
Collaborator

kimjoar commented Dec 10, 2015

I'm closing this as we're tracking it in #109

@kimjoar kimjoar closed this as completed Dec 10, 2015
@tomatau
Copy link
Contributor Author

tomatau commented Dec 10, 2015

Thanks for addressing this so quickly

@kimjoar kimjoar reopened this Dec 10, 2015
@kimjoar
Copy link
Collaborator

kimjoar commented Dec 10, 2015

I re-opened it. #109 already solves a double update, but there might be another problem here. Will look at it tomorrow.

@kimjoar
Copy link
Collaborator

kimjoar commented Dec 23, 2015

@tomatau Maybe you could try out #129 and see if it helps with the double onUpdate?

@tomatau
Copy link
Contributor Author

tomatau commented Dec 26, 2015

When navigating with pushPath, it dispatches @@router/UPDATE_PATH twice, once with state: false, replace: false and the second with state: null, replace: true.

When navigating with a normal Link (history), the @@router/UPDATE_PATH is only dispatched once, but the Router.onUpdate is still double invoked.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants