Skip to content

Commit c0db7dd

Browse files
committed
do not unregister ref if parent is being destroyed
1 parent d7d73db commit c0db7dd

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/instance/lifecycle.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@ exports._destroy = function (remove, deferCleanup) {
135135
var parent = this.$parent
136136
if (parent && !parent._isBeingDestroyed) {
137137
parent.$children.$remove(this)
138+
// unregister ref
139+
var ref = this.$options._ref
140+
if (ref) {
141+
var scope = this._scope || this._context
142+
if (scope.$refs[ref] === this) {
143+
scope.$refs[ref] = null
144+
}
145+
}
138146
}
139147
// remove self from owner fragment
140148
if (this._frag) {
@@ -158,14 +166,6 @@ exports._destroy = function (remove, deferCleanup) {
158166
while (i--) {
159167
this._watchers[i].teardown()
160168
}
161-
// unregister ref
162-
var ref = this.$options._ref
163-
if (ref) {
164-
var scope = this._scope || this._context
165-
if (scope.$[ref] === this) {
166-
scope.$[ref] = null
167-
}
168-
}
169169
// remove reference to self on $el
170170
if (this.$el) {
171171
this.$el.__vue__ = null

0 commit comments

Comments
 (0)