Skip to content

Commit

Permalink
Move store and history subscription back to constructor (@supasate in s…
Browse files Browse the repository at this point in the history
  • Loading branch information
pmarfany committed Apr 30, 2019
1 parent 6fc1182 commit 41fb786
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/ConnectedRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,18 @@ const createConnectedRouter = (structure) => {

constructor(props, context) {
super(props)
this.passedContext = context
}

componentDidMount() {
const { history, onLocationChanged } = this.props

this.inTimeTravelling = false

// Subscribe to store changes
this.unsubscribe = this.passedContext.store.subscribe(() => {
this.unsubscribe = context.store.subscribe(() => {
// Extract store's location
const {
pathname: pathnameInStore,
search: searchInStore,
hash: hashInStore,
} = getLocation(this.passedContext.store.getState())
} = getLocation(context.store.getState())
// Extract history's location
const {
pathname: pathnameInHistory,
Expand Down

0 comments on commit 41fb786

Please sign in to comment.