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

Remove INIT_PATH #97

Merged
merged 2 commits into from
Dec 18, 2015
Merged

Remove INIT_PATH #97

merged 2 commits into from
Dec 18, 2015

Conversation

kimjoar
Copy link
Collaborator

@kimjoar kimjoar commented Dec 9, 2015

No tests fail, so not sure we need this constant? We should either add a failing test or remove it.

The use case for removing this is receiving the initial URL when using UPDATE_PATH, e.g. #96.

(So the functional difference is: do we notify the initial route or only changes from the initial route?)

@jlongster
Copy link
Member

Thanks! Yes, it's just a functional difference. I did not add any tests for this functional difference yet. I'm not really sure which is more expected for the user; I'm fine removing it if we think UPDATE_PATH should be fired for the initial path too. (that should definitely be documented if so)

@@ -118,7 +105,8 @@ function syncReduxAndRouter(history, store, selectRouterState = SELECT_STATE) {
// trigger an unnecessary `pushState` on load
lastRoute = initialState;

store.dispatch(initPath(route.path, route.state));
const method = location.action === 'REPLACE' ? replacePath : pushPath;
store.dispatch(method(route.path, route.state, { avoidRouterUpdate: true }));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we can just directly use pushPath because we are avoiding a route update anyway.

@jlongster
Copy link
Member

Can you rebase this? I will merge it in.

@kimjoar
Copy link
Collaborator Author

kimjoar commented Dec 18, 2015

@jlongster Rebased

jlongster added a commit that referenced this pull request Dec 18, 2015
@jlongster jlongster merged commit bf35f05 into reactjs:master Dec 18, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants