Skip to content

Commit

Permalink
fix(code): Clear subscribers
Browse files Browse the repository at this point in the history
On error, be sure to clear any hoist subscribers
  • Loading branch information
adam-26 committed Mar 1, 2018
1 parent 85173d8 commit fd26dd4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/index.js
Expand Up @@ -409,6 +409,9 @@ function createChunkComponent(loadFn, options) {
res.promise = res.promise
.then(() => { hoistStatics(); })
.catch(err => {
// on error, clear hoist subscriptions
dynamicHoistComponentGetters.splice(0, dynamicHoistComponentGetters.length);

if (throwOnImportError === true) {
// When pre-loading, any loader errors will be thrown immediately (ie: hoistStatics, timeout options)
// - hoisting implies use of static methods, which need to be available prior to rendering.
Expand Down

0 comments on commit fd26dd4

Please sign in to comment.