hy-virtual-tree 1.1.22 → 1.1.23

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## Changelog
2
2
 
3
+ ### 1.1.23
4
+
5
+ _2025-09-13_
6
+
7
+ - 扩展[VirtualTree] 功能
8
+ (1)优化updateData缓存逻辑
9
+
3
10
  ### 1.1.22
4
11
 
5
12
  _2025-09-12_
package/dist/index.js CHANGED
@@ -2189,24 +2189,24 @@ class VirtualTree {
2189
2189
  let cacheTimer;
2190
2190
  let cacheTime = Date.now();
2191
2191
  const cacheInterval = 500;
2192
- const cacheData = new Map();
2192
+ let cacheData = [];
2193
2193
  return async (data, callback) => {
2194
2194
  if (!this._tree)
2195
2195
  return;
2196
2196
  cacheTimer && clearTimeout(cacheTimer);
2197
2197
  if (Array.isArray(data)) {
2198
2198
  data.forEach((item) => {
2199
- cacheData.set(this._getKey(item, true), item);
2199
+ cacheData.push(item);
2200
2200
  });
2201
2201
  }
2202
2202
  else {
2203
- cacheData.set(this._getKey(data, true), data);
2203
+ cacheData.push(data);
2204
2204
  }
2205
2205
  // cacheInterval毫秒仅更新一次数据
2206
2206
  if (Date.now() - cacheTime >= cacheInterval) {
2207
2207
  cacheTime = Date.now();
2208
- await this._updateTree(Array.from(cacheData.values()));
2209
- cacheData.clear();
2208
+ this._updateTree([...cacheData]);
2209
+ cacheData = [];
2210
2210
  this._refreshVirtualScroll();
2211
2211
  callback && callback();
2212
2212
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hy-virtual-tree",
3
- "version": "1.1.22",
3
+ "version": "1.1.23",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",