@kyro-cms/admin 0.10.5 → 0.10.6

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.js CHANGED
@@ -9945,11 +9945,14 @@ function AutoForm({
9945
9945
  const [now, setNow] = useState(Date.now());
9946
9946
  const disabled = propDisabled;
9947
9947
  const [clientLoading, setClientLoading] = useState(false);
9948
+ const fetchedRef = useRef(false);
9948
9949
  useEffect(() => {
9949
9950
  const shouldFetchCollection = collectionSlug && documentId && documentId !== "new";
9950
9951
  const shouldFetchGlobal = globalSlug;
9951
9952
  if (!shouldFetchCollection && !shouldFetchGlobal) return;
9953
+ if (fetchedRef.current) return;
9952
9954
  if (initialData && Object.keys(initialData).length > 0) return;
9955
+ fetchedRef.current = true;
9953
9956
  setClientLoading(true);
9954
9957
  const url = globalSlug ? `/api/globals/${globalSlug}` : `/api/${collectionSlug}/${documentId}`;
9955
9958
  apiGet(url, { autoToast: false }).then((result) => {
@@ -9959,7 +9962,7 @@ function AutoForm({
9959
9962
  }).catch(() => {
9960
9963
  setClientLoading(false);
9961
9964
  });
9962
- }, [collectionSlug, documentId, globalSlug, initialData]);
9965
+ }, [collectionSlug, documentId, globalSlug]);
9963
9966
  useEffect(() => {
9964
9967
  const id = setInterval(() => setNow(Date.now()), 1e4);
9965
9968
  return () => clearInterval(id);