lu-lowcode-package-form 0.11.72 → 0.11.73

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lu-lowcode-package-form",
3
- "version": "0.11.72",
3
+ "version": "0.11.73",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^4.8.1",
6
6
  "@dnd-kit/core": "^6.1.0",
@@ -720,10 +720,15 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
720
720
  const delay = lockStatus.current === 1 ? 500 : 100;
721
721
 
722
722
  timeoutRef.current = setTimeout(async () => {
723
- console.log("debounceHandleFieldsChange starting", changedFieldsState.current)
724
723
  // 开始新的更新周期
725
724
  dependencyGraphRef.current.startNewCycle();
726
725
 
726
+ // 创建当前变更的快照,避免处理过程中的并发修改
727
+ const currentChanges = {...changedFieldsState.current};
728
+ // 立即重置变更状态,为新的变更做准备
729
+ changedFieldsState.current = {};
730
+ console.log("debounceHandleFieldsChange starting", currentChanges)
731
+
727
732
  const fieldValues = form.getFieldsValue();
728
733
  const lockStatus_ = lockStatus.current;
729
734
  lockStatus.current = 0
@@ -733,9 +738,9 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
733
738
 
734
739
  // 创建已处理字段集合,用于避免多次处理同一字段
735
740
  const processedFields = new Set();
736
- for (let key in changedFieldsState.current) {
741
+ for (let key in currentChanges) {
737
742
  try {
738
- let field = changedFieldsState.current[key];
743
+ let field = currentChanges[key];
739
744
  console.log("debounceHandleFieldsChange field", field)
740
745
  console.log("debounceHandleFieldsChange getLastFieldValue", getLastFieldValue(field.name))
741
746
  if (!isEqual(field.value || "", getLastFieldValue(field.name) || "")) {
@@ -761,14 +766,12 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
761
766
  }
762
767
  } catch (error) {
763
768
  console.log("debounceHandleFieldsChange error", error)
764
-
765
769
  }
766
770
  }
767
771
  if (needRefresh) {
768
772
  console.log("needRefresh", needRefresh)
769
773
  updateFormContent();
770
774
  }
771
- changedFieldsState.current = {};
772
775
  }, delay);
773
776
  }, []);
774
777