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

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,15 @@ 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
+ this.api = new GridApi();
784
+ this.columnApi = new ColumnApi();
785
+ }
777
786
  this.mounted = false;
778
787
  this.isReady = false;
779
788
  window.removeEventListener('blur', this.handleFocus);
@@ -1396,8 +1405,8 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
1396
1405
  return this.props.fetch === undefined;
1397
1406
  }
1398
1407
  }, {
1399
- key: "clearReadyQueue",
1400
- value: function clearReadyQueue() {
1408
+ key: "flushReadyQueue",
1409
+ value: function flushReadyQueue() {
1401
1410
  this.readyQueue.forEach(function (cb) {
1402
1411
  cb();
1403
1412
  });
@@ -1406,6 +1415,9 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
1406
1415
  }, {
1407
1416
  key: "afterReady",
1408
1417
  value: function afterReady(cb) {
1418
+ if (!this.mounted) {
1419
+ return;
1420
+ }
1409
1421
  if (this.isReady) {
1410
1422
  cb();
1411
1423
  } else {
@@ -1517,7 +1529,7 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
1517
1529
  };
1518
1530
  })
1519
1531
  })).then(function (res) {
1520
- if (id !== _this6.requestId) {
1532
+ if (!_this6.mounted || id !== _this6.requestId) {
1521
1533
  return;
1522
1534
  }
1523
1535
  _this6.loadingChange(false);
@@ -1541,6 +1553,9 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
1541
1553
  fetchError: undefined
1542
1554
  });
1543
1555
  }).catch(function (err) {
1556
+ if (!_this6.mounted) {
1557
+ return;
1558
+ }
1544
1559
  _this6.store.setState({
1545
1560
  fetchError: err
1546
1561
  });
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.3",
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": "fc120ab90b363e45be5b8b4445b21e84ab2e79b2"
62
62
  }