Skip to content
This repository has been archived by the owner on Oct 23, 2019. It is now read-only.

Commit

Permalink
Fixed a bug where script injections would not work after the hot runt…
Browse files Browse the repository at this point in the history
…ime was executed - fixes #73
  • Loading branch information
markfinger committed Mar 12, 2016
1 parent a19a9bf commit c8ad1fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 0 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"no-negated-condition": 2,
"no-redeclare": 2,
"no-spaced-func": 2,
"no-ternary": 2,
"no-unused-vars": [2, {"argsIgnorePattern": "^_"}],
"no-whitespace-before-property": 2,
"one-var-declaration-per-line": 2,
Expand Down
9 changes: 7 additions & 2 deletions runtimes/hot.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,15 @@ _.forEach(__modules.modules, __modules.extendModule);
// not have a module available when we execute its dependent modules.
// To get around this, we buffer all the modules and only start to
// apply them once _.every pending module has been buffered
__modules.pending = {};
__modules.pending = null;
__modules.buffered = [];

// Monkey-patch `defineModule` so that we can intercept incoming modules
__modules.defineModule = function defineModuleHotWrapper(mod) {
if (!__modules.pending) {
return defineModule(mod);
}

mod = __modules.extendModule(mod);
const {name, hash} = mod;

Expand All @@ -252,7 +256,8 @@ __modules.defineModule = function defineModuleHotWrapper(mod) {
const readyToApply = _.every(__modules.pending, _.isUndefined);

if (readyToApply) {
__modules.pending = {};
__modules.pending = null;

const _buffered = __modules.buffered;
__modules.buffered = [];

Expand Down

0 comments on commit c8ad1fd

Please sign in to comment.