Skip to content

Commit b7cc7cb

Browse files
committed
chore: pr comments
1 parent 040e62f commit b7cc7cb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/react-form/src/useForm.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { FormApi, functionalUpdate, uuid } from '@tanstack/form-core'
44
import { useStore } from '@tanstack/react-store'
5-
import { useMemo, useRef, useState } from 'react'
5+
import { useRef, useState } from 'react'
66
import { Field } from './useField'
77
import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect'
88
import type {
@@ -189,7 +189,11 @@ export function useForm<
189189
TSubmitMeta
190190
>,
191191
) {
192-
const formId = useRef(opts?.formId ?? uuid())
192+
const formId = useRef<string>(opts?.formId as never)
193+
194+
if (!formId.current) {
195+
formId.current = uuid()
196+
}
193197

194198
const [formApi] = useState(() => {
195199
const api = new FormApi<

0 commit comments

Comments
 (0)