Skip to content

Commit

Permalink
window is undefined on server side, fixed invalid logic in SSR support
Browse files Browse the repository at this point in the history
  • Loading branch information
moersoy committed Jan 23, 2018
1 parent 6e308b3 commit 8336fa8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/searchkit/src/core/SearchkitManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class SearchkitManager {
searchOnLoad:true,
defaultSize:20,
createHistory:createHistoryInstance,
getLocation:()=> window.location
getLocation:()=> typeof window !== 'undefined' && window.location
})
this.host = host
this.guidGenerator = new GuidGenerator()
Expand Down
2 changes: 1 addition & 1 deletion packages/searchkit/src/core/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const decodeObjString = (str) => {
}

export const supportsHistory = ()=> {
return !!window.history
return typeof window !== 'undefined' && !!window.history
}

export const createHistoryInstance = function():History{
Expand Down

0 comments on commit 8336fa8

Please sign in to comment.