Merge pull request #2518 from payloadcms/fix/#2494-excess-versions

fix: #2494, reduces versions caused by reverting to published with autosave: true
This commit is contained in:
James Mikrut
2023-04-17 20:24:58 -04:00
committed by GitHub

View File

@@ -334,6 +334,7 @@ const Form: React.FC<Props> = (props) => {
const reset = useCallback(async (fieldSchema: Field[], data: unknown) => { const reset = useCallback(async (fieldSchema: Field[], data: unknown) => {
const state = await buildStateFromSchema({ fieldSchema, data, user, id, operation, locale, t }); const state = await buildStateFromSchema({ fieldSchema, data, user, id, operation, locale, t });
contextRef.current = { ...initContextState } as FormContextType; contextRef.current = { ...initContextState } as FormContextType;
setModified(false);
dispatchFields({ type: 'REPLACE_STATE', state }); dispatchFields({ type: 'REPLACE_STATE', state });
}, [id, user, operation, locale, t, dispatchFields]); }, [id, user, operation, locale, t, dispatchFields]);