@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 +4 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/AutoForm.tsx +5 -1
package/package.json
CHANGED
|
@@ -148,13 +148,17 @@ export function AutoForm({
|
|
|
148
148
|
const disabled = propDisabled;
|
|
149
149
|
const [clientLoading, setClientLoading] = useState(false);
|
|
150
150
|
|
|
151
|
+
const fetchedRef = useRef(false);
|
|
152
|
+
|
|
151
153
|
// Client-side fetch when SSR didn't provide data
|
|
152
154
|
useEffect(() => {
|
|
153
155
|
const shouldFetchCollection = collectionSlug && documentId && documentId !== "new";
|
|
154
156
|
const shouldFetchGlobal = globalSlug;
|
|
155
157
|
if (!shouldFetchCollection && !shouldFetchGlobal) return;
|
|
158
|
+
if (fetchedRef.current) return;
|
|
156
159
|
if (initialData && Object.keys(initialData).length > 0) return;
|
|
157
160
|
|
|
161
|
+
fetchedRef.current = true;
|
|
158
162
|
setClientLoading(true);
|
|
159
163
|
const url = globalSlug
|
|
160
164
|
? `/api/globals/${globalSlug}`
|
|
@@ -169,7 +173,7 @@ export function AutoForm({
|
|
|
169
173
|
.catch(() => {
|
|
170
174
|
setClientLoading(false);
|
|
171
175
|
});
|
|
172
|
-
}, [collectionSlug, documentId, globalSlug
|
|
176
|
+
}, [collectionSlug, documentId, globalSlug]);
|
|
173
177
|
|
|
174
178
|
// Tick every 10s so the "saved X ago" label stays fresh
|
|
175
179
|
useEffect(() => {
|