@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.cjs CHANGED
@@ -9966,11 +9966,14 @@ function AutoForm({
9966
9966
  const [now, setNow] = React.useState(Date.now());
9967
9967
  const disabled = propDisabled;
9968
9968
  const [clientLoading, setClientLoading] = React.useState(false);
9969
+ const fetchedRef = React.useRef(false);
9969
9970
  React.useEffect(() => {
9970
9971
  const shouldFetchCollection = collectionSlug && documentId && documentId !== "new";
9971
9972
  const shouldFetchGlobal = globalSlug;
9972
9973
  if (!shouldFetchCollection && !shouldFetchGlobal) return;
9974
+ if (fetchedRef.current) return;
9973
9975
  if (initialData && Object.keys(initialData).length > 0) return;
9976
+ fetchedRef.current = true;
9974
9977
  setClientLoading(true);
9975
9978
  const url = globalSlug ? `/api/globals/${globalSlug}` : `/api/${collectionSlug}/${documentId}`;
9976
9979
  apiGet(url, { autoToast: false }).then((result) => {
@@ -9980,7 +9983,7 @@ function AutoForm({
9980
9983
  }).catch(() => {
9981
9984
  setClientLoading(false);
9982
9985
  });
9983
- }, [collectionSlug, documentId, globalSlug, initialData]);
9986
+ }, [collectionSlug, documentId, globalSlug]);
9984
9987
  React.useEffect(() => {
9985
9988
  const id = setInterval(() => setNow(Date.now()), 1e4);
9986
9989
  return () => clearInterval(id);