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

Commit e143ac6

Browse files
committed
Reverting 3db2cfa
setTimeout doesn't work in the server context. Makes listening async. Don't have a good answer right now...
1 parent a00acfd commit e143ac6

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/index.js

+8-10
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,15 @@ export function syncHistory(history) {
5050
history.listen(location => { initialState.location = location })()
5151

5252
function middleware(store) {
53-
setTimeout(() => {
54-
unsubscribeHistory = history.listen(location => {
55-
currentKey = location.key
56-
if (syncing) {
57-
// Don't dispatch a new action if we're replaying location.
58-
return
59-
}
53+
unsubscribeHistory = history.listen(location => {
54+
currentKey = location.key
55+
if (syncing) {
56+
// Don't dispatch a new action if we're replaying location.
57+
return
58+
}
6059

61-
store.dispatch(updateLocation(location))
62-
})
63-
}, 0)
60+
store.dispatch(updateLocation(location))
61+
})
6462

6563
connected = true
6664

0 commit comments

Comments
 (0)