Skip to content

Commit

Permalink
fixed memory leak when replacing data on table with nested data
Browse files Browse the repository at this point in the history
  • Loading branch information
olifolkerd committed Jan 19, 2025
1 parent 000373b commit d240a35
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 2 deletions.
13 changes: 13 additions & 0 deletions dist/js/tabulator_esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -4395,6 +4395,7 @@ class DataTree extends Module{

this.subscribe("row-init", this.initializeRow.bind(this));
this.subscribe("row-layout-after", this.layoutRow.bind(this));
this.subscribe("row-deleting", this.rowDeleting.bind(this));
this.subscribe("row-deleted", this.rowDelete.bind(this),0);
this.subscribe("row-data-changed", this.rowDataChanged.bind(this), 10);
this.subscribe("cell-value-updated", this.cellValueChanged.bind(this));
Expand Down Expand Up @@ -4734,6 +4735,18 @@ class DataTree extends Module{
return output;
}

rowDeleting(row){
var config = row.modules.dataTree;

if (config && config.children && Array.isArray(config.children)){
config.children.forEach((childRow) => {
if(childRow instanceof Row){
childRow.wipe();
}
});
}
}

rowDelete(row){
var parent = row.modules.dataTree.parent,
childIndex;
Expand Down
2 changes: 1 addition & 1 deletion dist/js/tabulator_esm.js.map

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions dist/js/tabulator_esm.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4395,6 +4395,7 @@ class DataTree extends Module{

this.subscribe("row-init", this.initializeRow.bind(this));
this.subscribe("row-layout-after", this.layoutRow.bind(this));
this.subscribe("row-deleting", this.rowDeleting.bind(this));
this.subscribe("row-deleted", this.rowDelete.bind(this),0);
this.subscribe("row-data-changed", this.rowDataChanged.bind(this), 10);
this.subscribe("cell-value-updated", this.cellValueChanged.bind(this));
Expand Down Expand Up @@ -4734,6 +4735,18 @@ class DataTree extends Module{
return output;
}

rowDeleting(row){
var config = row.modules.dataTree;

if (config && config.children && Array.isArray(config.children)){
config.children.forEach((childRow) => {
if(childRow instanceof Row){
childRow.wipe();
}
});
}
}

rowDelete(row){
var parent = row.modules.dataTree.parent,
childIndex;
Expand Down
2 changes: 1 addition & 1 deletion dist/js/tabulator_esm.mjs.map

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions src/js/modules/DataTree/DataTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export default class DataTree extends Module{

this.subscribe("row-init", this.initializeRow.bind(this));
this.subscribe("row-layout-after", this.layoutRow.bind(this));
this.subscribe("row-deleting", this.rowDeleting.bind(this));
this.subscribe("row-deleted", this.rowDelete.bind(this),0);
this.subscribe("row-data-changed", this.rowDataChanged.bind(this), 10);
this.subscribe("cell-value-updated", this.cellValueChanged.bind(this));
Expand Down Expand Up @@ -464,6 +465,18 @@ export default class DataTree extends Module{
return output;
}

rowDeleting(row){
var config = row.modules.dataTree;

if (config && config.children && Array.isArray(config.children)){
config.children.forEach((childRow) => {
if(childRow instanceof Row){
childRow.wipe();
}
});
}
}

rowDelete(row){
var parent = row.modules.dataTree.parent,
childIndex;
Expand Down

0 comments on commit d240a35

Please sign in to comment.