Skip to content

Commit

Permalink
Fix model/component hot reload when using class
Browse files Browse the repository at this point in the history
  • Loading branch information
StefansArya committed Oct 3, 2021
1 parent 17165f8 commit 128829b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/sf-hot-reload.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,11 +467,14 @@ function reapplyScope(proxy, space, scope, func, forceHaveLoaded){
let modelKeys = getModelKeys(scope, true);
scope.sf$internal.modelKeysRegex.v = RegExp(`${sfRegex.scopeVar}(${modelKeys})`, 'g');
}

scope.hotReloading = false;
}
else Object.setPrototypeOf(scope, func.class.prototype);
else{
firstTime = false;
scope.hotReload && scope.hotReload(scope);
Object.setPrototypeOf(scope, func.class.prototype);
}

scope.hotReloading = false;
if(!firstTime || forceHaveLoaded){
scope.sf$refresh && scope.sf$refresh.forEach(v=>v());
scope.hotReloaded && scope.hotReloaded();
Expand Down

0 comments on commit 128829b

Please sign in to comment.