@lemon-fe/components 1.4.28-alpha.2 → 1.4.28-alpha.4

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.
@@ -68,7 +68,7 @@ declare class InternalDataGrid<TData extends Record<string, any>> extends Compon
68
68
  private getFullColumnDef;
69
69
  private getColumnDefs;
70
70
  isClientMode(): boolean;
71
- private clearReadyQueue;
71
+ private flushReadyQueue;
72
72
  afterReady(cb: () => void): void;
73
73
  private isPreserveSelected;
74
74
  private updateRowData;
@@ -323,7 +323,7 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
323
323
  });
324
324
  }
325
325
  });
326
- _this.clearReadyQueue();
326
+ _this.flushReadyQueue();
327
327
  case 20:
328
328
  case "end":
329
329
  return _context.stop();
@@ -774,6 +774,25 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
774
774
  }, {
775
775
  key: "componentWillUnmount",
776
776
  value: function componentWillUnmount() {
777
+ if (this.isReady) {
778
+ // 解决agGrid部分内存泄漏
779
+
780
+ this.dataSource = [];
781
+ this.api.setRowData([]);
782
+ this.api.setColumnDefs([]);
783
+ var context = this.api.__getContext();
784
+ var gridOptionsService = context.getBean('gridOptionsService');
785
+ for (var field in gridOptionsService.gridOptions) {
786
+ delete gridOptionsService.gridOptions[field];
787
+ }
788
+ var userComponentFactory = context.getBean('userComponentFactory');
789
+ userComponentFactory.frameworkComponentWrapper.parent = null;
790
+ var eventService = context.getBean('eventService');
791
+ eventService.allAsyncListeners.clear();
792
+ eventService.globalAsyncListeners.clear();
793
+ this.api = new GridApi();
794
+ this.columnApi = new ColumnApi();
795
+ }
777
796
  this.mounted = false;
778
797
  this.isReady = false;
779
798
  window.removeEventListener('blur', this.handleFocus);
@@ -1396,8 +1415,8 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
1396
1415
  return this.props.fetch === undefined;
1397
1416
  }
1398
1417
  }, {
1399
- key: "clearReadyQueue",
1400
- value: function clearReadyQueue() {
1418
+ key: "flushReadyQueue",
1419
+ value: function flushReadyQueue() {
1401
1420
  this.readyQueue.forEach(function (cb) {
1402
1421
  cb();
1403
1422
  });
@@ -1406,6 +1425,9 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
1406
1425
  }, {
1407
1426
  key: "afterReady",
1408
1427
  value: function afterReady(cb) {
1428
+ if (!this.mounted) {
1429
+ return;
1430
+ }
1409
1431
  if (this.isReady) {
1410
1432
  cb();
1411
1433
  } else {
@@ -1517,7 +1539,7 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
1517
1539
  };
1518
1540
  })
1519
1541
  })).then(function (res) {
1520
- if (id !== _this6.requestId) {
1542
+ if (!_this6.mounted || id !== _this6.requestId) {
1521
1543
  return;
1522
1544
  }
1523
1545
  _this6.loadingChange(false);
@@ -1541,6 +1563,9 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
1541
1563
  fetchError: undefined
1542
1564
  });
1543
1565
  }).catch(function (err) {
1566
+ if (!_this6.mounted) {
1567
+ return;
1568
+ }
1544
1569
  _this6.store.setState({
1545
1570
  fetchError: err
1546
1571
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/components",
3
- "version": "1.4.28-alpha.2",
3
+ "version": "1.4.28-alpha.4",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "MIT",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "registry": "https://registry.npmjs.org"
60
60
  },
61
- "gitHead": "ab72bcf9c66072be25cadc0a50ab44c17cc78ec5"
61
+ "gitHead": "afba47f33e6a25504b0c531e3fff638fa6fa7132"
62
62
  }