@trudb/tru-common-lib 0.2.269 → 0.2.271

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7785,8 +7785,16 @@ class TruDataGrid {
7785
7785
  }));
7786
7786
  }
7787
7787
  this.subs.push(this.connectionHub.subscribe(this.dataContext, this.config.resultConfig.entityType, this.config.resultConfig.entityType.name, this.addEntity, this.getRowData, () => { return this.latestSetupQuery; }, this.config.resultConfig.expands, [], () => { return true; }).subscribe((dataChange) => {
7788
+ let rowNodesToAdd = [];
7788
7789
  let rowNodesToRemove = [];
7789
7790
  dataChange.dataChanges.forEach((change) => {
7791
+ if (change.changeOperation === 'I') {
7792
+ this.api.forEachNode(function (rowNode) {
7793
+ if (rowNode.data.$entity.Ref === change.tableRef) {
7794
+ rowNodesToAdd.push(rowNode.data);
7795
+ }
7796
+ });
7797
+ }
7790
7798
  if (change.changeOperation === 'D') {
7791
7799
  this.api.forEachNode(function (rowNode) {
7792
7800
  if (rowNode.data.$entity.Ref === change.tableRef) {
@@ -7795,13 +7803,15 @@ class TruDataGrid {
7795
7803
  });
7796
7804
  }
7797
7805
  });
7798
- if (rowNodesToRemove.length) {
7799
- this.api.applyTransaction({ remove: rowNodesToRemove });
7806
+ if (rowNodesToAdd.length) {
7807
+ this.api.applyTransaction({ add: rowNodesToAdd });
7800
7808
  this.api.refreshCells({ force: true });
7801
7809
  }
7802
- else {
7810
+ if (rowNodesToRemove.length) {
7811
+ this.api.applyTransaction({ remove: rowNodesToRemove });
7803
7812
  this.api.refreshCells({ force: true });
7804
7813
  }
7814
+ this.api.refreshCells({ force: true });
7805
7815
  }));
7806
7816
  // Listen for entities added elsewhere in the app
7807
7817
  // Merge this logic with addEntity() logic below