Skip to content

Commit d240a35

Browse files
committed
fixed memory leak when replacing data on table with nested data
1 parent 000373b commit d240a35

File tree

5 files changed

+41
-2
lines changed

5 files changed

+41
-2
lines changed

dist/js/tabulator_esm.js

+13
Original file line numberDiff line numberDiff line change
@@ -4395,6 +4395,7 @@ class DataTree extends Module{
43954395

43964396
this.subscribe("row-init", this.initializeRow.bind(this));
43974397
this.subscribe("row-layout-after", this.layoutRow.bind(this));
4398+
this.subscribe("row-deleting", this.rowDeleting.bind(this));
43984399
this.subscribe("row-deleted", this.rowDelete.bind(this),0);
43994400
this.subscribe("row-data-changed", this.rowDataChanged.bind(this), 10);
44004401
this.subscribe("cell-value-updated", this.cellValueChanged.bind(this));
@@ -4734,6 +4735,18 @@ class DataTree extends Module{
47344735
return output;
47354736
}
47364737

4738+
rowDeleting(row){
4739+
var config = row.modules.dataTree;
4740+
4741+
if (config && config.children && Array.isArray(config.children)){
4742+
config.children.forEach((childRow) => {
4743+
if(childRow instanceof Row){
4744+
childRow.wipe();
4745+
}
4746+
});
4747+
}
4748+
}
4749+
47374750
rowDelete(row){
47384751
var parent = row.modules.dataTree.parent,
47394752
childIndex;

dist/js/tabulator_esm.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/tabulator_esm.mjs

+13
Original file line numberDiff line numberDiff line change
@@ -4395,6 +4395,7 @@ class DataTree extends Module{
43954395

43964396
this.subscribe("row-init", this.initializeRow.bind(this));
43974397
this.subscribe("row-layout-after", this.layoutRow.bind(this));
4398+
this.subscribe("row-deleting", this.rowDeleting.bind(this));
43984399
this.subscribe("row-deleted", this.rowDelete.bind(this),0);
43994400
this.subscribe("row-data-changed", this.rowDataChanged.bind(this), 10);
44004401
this.subscribe("cell-value-updated", this.cellValueChanged.bind(this));
@@ -4734,6 +4735,18 @@ class DataTree extends Module{
47344735
return output;
47354736
}
47364737

4738+
rowDeleting(row){
4739+
var config = row.modules.dataTree;
4740+
4741+
if (config && config.children && Array.isArray(config.children)){
4742+
config.children.forEach((childRow) => {
4743+
if(childRow instanceof Row){
4744+
childRow.wipe();
4745+
}
4746+
});
4747+
}
4748+
}
4749+
47374750
rowDelete(row){
47384751
var parent = row.modules.dataTree.parent,
47394752
childIndex;

dist/js/tabulator_esm.mjs.map

+1-1
Large diffs are not rendered by default.

src/js/modules/DataTree/DataTree.js

+13
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ export default class DataTree extends Module{
125125

126126
this.subscribe("row-init", this.initializeRow.bind(this));
127127
this.subscribe("row-layout-after", this.layoutRow.bind(this));
128+
this.subscribe("row-deleting", this.rowDeleting.bind(this));
128129
this.subscribe("row-deleted", this.rowDelete.bind(this),0);
129130
this.subscribe("row-data-changed", this.rowDataChanged.bind(this), 10);
130131
this.subscribe("cell-value-updated", this.cellValueChanged.bind(this));
@@ -464,6 +465,18 @@ export default class DataTree extends Module{
464465
return output;
465466
}
466467

468+
rowDeleting(row){
469+
var config = row.modules.dataTree;
470+
471+
if (config && config.children && Array.isArray(config.children)){
472+
config.children.forEach((childRow) => {
473+
if(childRow instanceof Row){
474+
childRow.wipe();
475+
}
476+
});
477+
}
478+
}
479+
467480
rowDelete(row){
468481
var parent = row.modules.dataTree.parent,
469482
childIndex;

0 commit comments

Comments
 (0)