sy-form-components 0.2.10 → 0.2.11

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/dist/index.mjs CHANGED
@@ -7727,12 +7727,17 @@ function useFormDetail(options) {
7727
7727
  const [instanceInfo, setInstanceInfo] = useState24(null);
7728
7728
  const [permissions, setPermissions] = useState24(null);
7729
7729
  const mountedRef = useRef9(true);
7730
+ const onPermissionDeniedRef = useRef9(onPermissionDenied);
7731
+ const fieldIdsKey = fieldIds?.join("") ?? "";
7730
7732
  useEffect29(() => {
7731
7733
  mountedRef.current = true;
7732
7734
  return () => {
7733
7735
  mountedRef.current = false;
7734
7736
  };
7735
7737
  }, []);
7738
+ useEffect29(() => {
7739
+ onPermissionDeniedRef.current = onPermissionDenied;
7740
+ }, [onPermissionDenied]);
7736
7741
  const loadData = useCallback11(async () => {
7737
7742
  if (!mountedRef.current) return;
7738
7743
  setLoading(true);
@@ -7743,7 +7748,7 @@ function useFormDetail(options) {
7743
7748
  ]);
7744
7749
  if (!mountedRef.current) return;
7745
7750
  if (!permResult || !hasViewOperation(permResult.operations, "view")) {
7746
- onPermissionDenied?.();
7751
+ onPermissionDeniedRef.current?.();
7747
7752
  }
7748
7753
  const normalizedInfo = normalizeFormInstanceInfo(formResult, {
7749
7754
  formUuid,
@@ -7752,7 +7757,9 @@ function useFormDetail(options) {
7752
7757
  });
7753
7758
  setPermissions(permResult);
7754
7759
  setInstanceInfo(normalizedInfo);
7755
- setFormData(extractFormValues(formResult, fieldIds));
7760
+ setFormData(
7761
+ extractFormValues(formResult, fieldIdsKey ? fieldIdsKey.split("") : void 0)
7762
+ );
7756
7763
  } catch (error) {
7757
7764
  console.error("[useFormDetail] Failed to load data:", error);
7758
7765
  if (mountedRef.current) {
@@ -7765,7 +7772,7 @@ function useFormDetail(options) {
7765
7772
  setLoading(false);
7766
7773
  }
7767
7774
  }
7768
- }, [request, formUuid, appType, formInstanceId, fieldIds, onPermissionDenied]);
7775
+ }, [request, formUuid, appType, formInstanceId, fieldIdsKey]);
7769
7776
  useEffect29(() => {
7770
7777
  loadData();
7771
7778
  }, [loadData]);
@@ -7861,6 +7868,7 @@ function useProcessDetail(options) {
7861
7868
  const [permissions, setPermissions] = useState25(null);
7862
7869
  const [processDefinition, setProcessDefinition] = useState25(null);
7863
7870
  const mountedRef = useRef10(true);
7871
+ const fieldIdsKey = fieldIds?.join("") ?? "";
7864
7872
  useEffect30(() => {
7865
7873
  mountedRef.current = true;
7866
7874
  return () => {
@@ -7906,7 +7914,9 @@ function useProcessDetail(options) {
7906
7914
  setApprovalTasks(approvalResult?.currentTasks ?? []);
7907
7915
  setPermissions(permResult);
7908
7916
  setInstanceInfo(formResult);
7909
- setFormData(extractFormValues(formResult, fieldIds));
7917
+ setFormData(
7918
+ extractFormValues(formResult, fieldIdsKey ? fieldIdsKey.split("") : void 0)
7919
+ );
7910
7920
  if (permResult?.operations?.includes("VIEW_PROCESS") || permResult?.operations?.length > 0) {
7911
7921
  try {
7912
7922
  const progress = await getProcessProgress(request, formInstanceId);
@@ -7941,7 +7951,7 @@ function useProcessDetail(options) {
7941
7951
  setLoading(false);
7942
7952
  }
7943
7953
  }
7944
- }, [request, formUuid, appType, formInstanceId, fieldIds]);
7954
+ }, [request, formUuid, appType, formInstanceId, fieldIdsKey]);
7945
7955
  useEffect30(() => {
7946
7956
  loadData();
7947
7957
  }, [loadData]);