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

Commit bf35f05

Browse files
committed
Merge pull request #97 from kjbekkelund/remove-init-path
Remove `INIT_PATH`
2 parents 5ddaf3c + a985b5b commit bf35f05

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

src/index.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,9 @@ import deepEqual from 'deep-equal'
22

33
// Constants
44

5-
const INIT_PATH = '@@router/INIT_PATH'
65
export const UPDATE_PATH = '@@router/UPDATE_PATH'
76
const SELECT_STATE = state => state.routing
87

9-
// Action creators
10-
11-
function initPath(path, state) {
12-
return {
13-
type: INIT_PATH,
14-
payload: {
15-
path: path,
16-
state: state,
17-
replace: false,
18-
avoidRouterUpdate: true
19-
}
20-
}
21-
}
22-
238
export function pushPath(path, state, { avoidRouterUpdate = false } = {}) {
249
return {
2510
type: UPDATE_PATH,
@@ -54,7 +39,7 @@ let initialState = {
5439
}
5540

5641
function update(state=initialState, { type, payload }) {
57-
if(type === INIT_PATH || type === UPDATE_PATH) {
42+
if(type === UPDATE_PATH) {
5843
return Object.assign({}, state, {
5944
path: payload.path,
6045
changeId: state.changeId + (payload.avoidRouterUpdate ? 0 : 1),
@@ -128,7 +113,7 @@ export function syncReduxAndRouter(history, store, selectRouterState = SELECT_ST
128113
// trigger an unnecessary `pushState` on load
129114
lastRoute = initialState
130115

131-
store.dispatch(initPath(route.path, route.state))
116+
store.dispatch(pushPath(route.path, route.state, { avoidRouterUpdate: true }));
132117
} else if(!locationsAreEqual(getRouterState(), route)) {
133118
// The above check avoids dispatching an action if the store is
134119
// already up-to-date

0 commit comments

Comments
 (0)