Skip to content

Commit 07a3726

Browse files
committed
remove reference to refElm after initial patch (fix #5851)
1 parent 4733408 commit 07a3726

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/core/instance/lifecycle.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ export function lifecycleMixin (Vue: Class<Component>) {
6565
vm.$options._parentElm,
6666
vm.$options._refElm
6767
)
68+
// no need for the ref nodes after initial patch
69+
// this prevents keeping a detached DOM tree in memory (#5851)
70+
vm.$options._parentElm = vm.$options._refElm = null
6871
} else {
6972
// updates
7073
vm.$el = vm.__patch__(prevVnode, vnode)
@@ -129,8 +132,6 @@ export function lifecycleMixin (Vue: Class<Component>) {
129132
if (vm.$el) {
130133
vm.$el.__vue__ = null
131134
}
132-
// remove reference to DOM nodes (prevents leak)
133-
vm.$options._parentElm = vm.$options._refElm = null
134135
}
135136
}
136137

0 commit comments

Comments
 (0)