Skip to content

Commit 28ae14c

Browse files
committed
fix: only unregister/register components when not hot updating in shimmed unbuild function
1 parent e4d6e49 commit 28ae14c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

lib/hot-reload-api.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,14 @@ exports.install = function (Vue) {
4141

4242
function shimComponent (dir, map) {
4343
shimMethod(dir, 'unbuild', function (defer) {
44-
var prevComponent = this.childVM && this.childVM.constructor
45-
removeComponent(prevComponent, map, this)
46-
// defer = true means we are transitioning to a new
47-
// Component. Register this new component to the list.
48-
if (defer) {
49-
addComponent(this.Component, map, this)
44+
if (!this.hotUpdating) {
45+
var prevComponent = this.childVM && this.childVM.constructor
46+
removeComponent(prevComponent, map, this)
47+
// defer = true means we are transitioning to a new
48+
// Component. Register this new component to the list.
49+
if (defer) {
50+
addComponent(this.Component, map, this)
51+
}
5052
}
5153
})
5254
}
@@ -113,6 +115,7 @@ exports.update = function (view) {
113115
if (!view._bound) {
114116
return
115117
}
118+
view.hotUpdating = true
116119
// disable transitions
117120
view.vm._isCompiled = false
118121
// save state
@@ -126,4 +129,5 @@ exports.update = function (view) {
126129
view.childVM.$data = state
127130
// re-eanble transitions
128131
view.vm._isCompiled = true
132+
view.hotUpdating = false
129133
}

0 commit comments

Comments
 (0)