summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-core
diff options
context:
space:
mode:
authorSamy Pesse <samypesse@gmail.com>2016-12-04 20:43:55 +0100
committerSamy Pesse <samypesse@gmail.com>2016-12-04 20:43:55 +0100
commit5dbd8f57401a82e9e5c86192480a239040327740 (patch)
tree469b0189de3857633a76c362ed2b9af2be52b139 /packages/gitbook-core
parentf3af207e6ed786dd817c4a1c4d73efd083afd298 (diff)
downloadgitbook-5dbd8f57401a82e9e5c86192480a239040327740.zip
gitbook-5dbd8f57401a82e9e5c86192480a239040327740.tar.gz
gitbook-5dbd8f57401a82e9e5c86192480a239040327740.tar.bz2
History is activated with a setup location
Diffstat (limited to 'packages/gitbook-core')
-rw-r--r--packages/gitbook-core/src/actions/history.js1
-rw-r--r--packages/gitbook-core/src/reducers/history.js3
2 files changed, 3 insertions, 1 deletions
diff --git a/packages/gitbook-core/src/actions/history.js b/packages/gitbook-core/src/actions/history.js
index a7cf228..1c33f4a 100644
--- a/packages/gitbook-core/src/actions/history.js
+++ b/packages/gitbook-core/src/actions/history.js
@@ -14,7 +14,6 @@ const SUPPORTED = (
*/
function activate() {
return (dispatch, getState) => {
-
dispatch({
type: ACTION_TYPES.HISTORY_ACTIVATE,
listener: (location) => {
diff --git a/packages/gitbook-core/src/reducers/history.js b/packages/gitbook-core/src/reducers/history.js
index d78b158..8d2a2fb 100644
--- a/packages/gitbook-core/src/reducers/history.js
+++ b/packages/gitbook-core/src/reducers/history.js
@@ -1,6 +1,7 @@
const { Record, List } = require('immutable');
const { createBrowserHistory, createMemoryHistory } = require('history');
const ACTION_TYPES = require('../actions/TYPES');
+const Location = require('../models/Location');
const isServerSide = (typeof window === 'undefined');
@@ -45,6 +46,8 @@ function reduceHistory(state, action) {
// We can't use .merge since it convert history to an immutable
const newState = state
+ // TODO: we should find a way to have the correct location on server side
+ .set('location', isServerSide ? new Location() : Location.fromNative(window.location))
.set('client', client)
.set('unlisten', unlisten);