Skip to content

Commit

Permalink
Merge pull request #58 from wsfe/feat/memory-leak-mitigation-2.x
Browse files Browse the repository at this point in the history
feat: memory leak mitigation 2.x
  • Loading branch information
ChuChencheng committed Jun 10, 2023
2 parents 0f9928a + 6e539b4 commit d20c6b4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wsfe/ctree",
"version": "2.3.0",
"version": "2.3.1",
"main": "./dist/ctree.umd.min.js",
"types": "./types",
"description": "A vue tree component using virtual list.",
Expand Down
31 changes: 18 additions & 13 deletions src/components/Tree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -813,22 +813,26 @@ export default (Vue as VueConstructor<Vue & {
this.debounceTimer = window.requestAnimationFrame(this.updateRenderNodes.bind(this, true))
// this.updateRenderNodes(true)
},
initializeNonReactiveData (): void {
const { keyField, ignoreMode, filteredNodeCheckable, cascade, defaultExpandAll, load, expandOnFilter } = this
this.nonReactive = {
store: new TreeStore({
keyField,
ignoreMode,
filteredNodeCheckable,
cascade,
defaultExpandAll,
load,
expandOnFilter,
}),
blockNodes: [],
}
},
},
created () {
// Initial non-reactive
const { keyField, ignoreMode, filteredNodeCheckable, cascade, defaultExpandAll, load, expandOnFilter } = this
this.nonReactive = {
store: new TreeStore({
keyField,
ignoreMode,
filteredNodeCheckable,
cascade,
defaultExpandAll,
load,
expandOnFilter,
}),
blockNodes: [],
}
this.initializeNonReactiveData()
this.nonReactive.store.on('visible-data-change', this.updateBlockNodes)
this.nonReactive.store.on('render-data-change', this.updateRender)
Expand Down Expand Up @@ -860,6 +864,7 @@ export default (Vue as VueConstructor<Vue & {
if ($iframe.contentWindow) {
$iframe.contentWindow.removeEventListener('resize', this.updateRender)
}
this.initializeNonReactiveData()
},
watch: {
value (newVal: VModelType) {
Expand Down

0 comments on commit d20c6b4

Please sign in to comment.