Skip to content

Commit def4de3

Browse files
committed
chore: pr comments
1 parent 7388598 commit def4de3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/react-form/src/useForm.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,17 +215,17 @@ export function useForm<
215215
// stable reference of form options, needs to be tracked so form.update is only called
216216
// when props are changed.
217217
const stableOptsRef = useRef<typeof opts>(opts)
218-
if (!evaluate(opts, stableOptsRef.current)) {
219-
stableOptsRef.current = opts
220-
}
221218

222219
/**
223220
* formApi.update should not have any side effects. Think of it like a `useRef`
224221
* that we need to keep updated every render with the most up-to-date information.
225222
*/
226223
useIsomorphicLayoutEffect(() => {
227-
formApi.update(stableOptsRef.current)
228-
}, [stableOptsRef.current])
224+
if (!evaluate(opts, stableOptsRef.current)) {
225+
stableOptsRef.current = opts
226+
formApi.update(opts)
227+
}
228+
})
229229

230230
return formApi
231231
}

0 commit comments

Comments
 (0)