Skip to content

Commit fb9bcb7

Browse files
committed
feat: reset non reactive data before component destroy
1 parent 0f9928a commit fb9bcb7

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

src/components/Tree.vue

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -813,22 +813,26 @@ export default (Vue as VueConstructor<Vue & {
813813
this.debounceTimer = window.requestAnimationFrame(this.updateRenderNodes.bind(this, true))
814814
// this.updateRenderNodes(true)
815815
},
816+
817+
initializeNonReactiveData (): void {
818+
const { keyField, ignoreMode, filteredNodeCheckable, cascade, defaultExpandAll, load, expandOnFilter } = this
819+
this.nonReactive = {
820+
store: new TreeStore({
821+
keyField,
822+
ignoreMode,
823+
filteredNodeCheckable,
824+
cascade,
825+
defaultExpandAll,
826+
load,
827+
expandOnFilter,
828+
}),
829+
blockNodes: [],
830+
}
831+
},
816832
},
817833
created () {
818834
// Initial non-reactive
819-
const { keyField, ignoreMode, filteredNodeCheckable, cascade, defaultExpandAll, load, expandOnFilter } = this
820-
this.nonReactive = {
821-
store: new TreeStore({
822-
keyField,
823-
ignoreMode,
824-
filteredNodeCheckable,
825-
cascade,
826-
defaultExpandAll,
827-
load,
828-
expandOnFilter,
829-
}),
830-
blockNodes: [],
831-
}
835+
this.initializeNonReactiveData()
832836
833837
this.nonReactive.store.on('visible-data-change', this.updateBlockNodes)
834838
this.nonReactive.store.on('render-data-change', this.updateRender)
@@ -860,6 +864,7 @@ export default (Vue as VueConstructor<Vue & {
860864
if ($iframe.contentWindow) {
861865
$iframe.contentWindow.removeEventListener('resize', this.updateRender)
862866
}
867+
this.initializeNonReactiveData()
863868
},
864869
watch: {
865870
value (newVal: VModelType) {

0 commit comments

Comments
 (0)