@zat-design/sisyphus-react 3.14.10-beta.8 → 3.14.10-beta.9

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.
@@ -134,7 +134,9 @@ var ProTree = props => {
134
134
  debounceWait: 300
135
135
  }, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options));
136
136
  useDeepCompareEffect(() => {
137
- if (dataSource && dataSource.length) {
137
+ // 显式传入数组(含空数组 [])时都同步到内部 state,
138
+ // 否则删除最后一个节点后 dataSource 变为 [] 时树数据不会被清空。
139
+ if (Array.isArray(dataSource)) {
138
140
  var allKey = getAllKeys(dataSource, fieldNames);
139
141
  setState({
140
142
  treeData: dataSource,
@@ -140,7 +140,9 @@ var ProTree = props => {
140
140
  debounceWait: 300
141
141
  }, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options));
142
142
  (0, _ahooks.useDeepCompareEffect)(() => {
143
- if (dataSource && dataSource.length) {
143
+ // 显式传入数组(含空数组 [])时都同步到内部 state,
144
+ // 否则删除最后一个节点后 dataSource 变为 [] 时树数据不会被清空。
145
+ if (Array.isArray(dataSource)) {
144
146
  var allKey = (0, _utils.getAllKeys)(dataSource, fieldNames);
145
147
  setState({
146
148
  treeData: dataSource,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.14.10-beta.8",
3
+ "version": "3.14.10-beta.9",
4
4
  "license": "MIT",
5
5
  "engines": {
6
6
  "node": ">=18.19.0"