Skip to content

Commit

Permalink
fix: state could have no children
Browse files Browse the repository at this point in the history
Fix #36
  • Loading branch information
gregberge committed Feb 4, 2018
1 parent a8650db commit a47c410
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
2 changes: 1 addition & 1 deletion src/loadComponents.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function loadComponents() {
}

const state = window[LOADABLE_STATE]
if (!state || !state.children) {
if (!state) {
throw new Error(
'loadable-components state not found. ' +
'You have a problem server-side. ' +
Expand Down
11 changes: 0 additions & 11 deletions src/loadComponents.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,4 @@ describe('loadComponents', () => {
expect(err.message).toMatch(/loadable-components state not found/)
}
})

it('should handle no children', async () => {
delete window[LOADABLE_STATE].children
expect.assertions(1)

try {
await loadComponents()
} catch (err) {
expect(err.message).toMatch(/loadable-components state not found/)
}
})
})

0 comments on commit a47c410

Please sign in to comment.