Skip to content

Commit 19f1494

Browse files
committed
rename history
1 parent 722f82b commit 19f1494

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/client.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ import useScroll from 'scroll-behavior/lib/useStandardScroll';
1616
import getRoutes from './routes';
1717

1818
const client = new ApiClient();
19-
const history = useScroll(() => browserHistory)();
19+
const _browserHistory = useScroll(() => browserHistory)();
2020
const dest = document.getElementById('content');
21-
const store = createStore(history, client, window.__data);
22-
const syncedHistory = syncHistoryWithStore(history, store);
21+
const store = createStore(_browserHistory, client, window.__data);
22+
const history = syncHistoryWithStore(_browserHistory, store);
2323

2424
function initSocket() {
2525
const socket = io('', {path: '/ws'});
@@ -39,7 +39,7 @@ global.socket = initSocket();
3939
const component = (
4040
<Router render={(props) =>
4141
<ReduxAsyncConnect {...props} helpers={{client}} filter={item => !item.deferred} />
42-
} history={syncedHistory}>
42+
} history={history}>
4343
{getRoutes(store)}
4444
</Router>
4545
);

src/server.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,9 @@ app.use((req, res) => {
6767
webpackIsomorphicTools.refresh();
6868
}
6969
const client = new ApiClient(req);
70-
const history = createHistory(req.originalUrl);
71-
72-
const store = createStore(history, client);
73-
74-
const syncedHistory = syncHistoryWithStore(history, store);
70+
const memoryHistory = createHistory(req.originalUrl);
71+
const store = createStore(memoryHistory, client);
72+
const history = syncHistoryWithStore(memoryHistory, store);
7573

7674
function hydrateOnClient() {
7775
res.send('<!doctype html>\n' +
@@ -83,7 +81,7 @@ app.use((req, res) => {
8381
return;
8482
}
8583

86-
match({ syncedHistory, routes: getRoutes(store), location: req.originalUrl }, (error, redirectLocation, renderProps) => {
84+
match({ history, routes: getRoutes(store), location: req.originalUrl }, (error, redirectLocation, renderProps) => {
8785
if (redirectLocation) {
8886
res.redirect(redirectLocation.pathname + redirectLocation.search);
8987
} else if (error) {

0 commit comments

Comments
 (0)