We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 040e62f commit b7cc7cbCopy full SHA for b7cc7cb
packages/react-form/src/useForm.tsx
@@ -2,7 +2,7 @@
2
3
import { FormApi, functionalUpdate, uuid } from '@tanstack/form-core'
4
import { useStore } from '@tanstack/react-store'
5
-import { useMemo, useRef, useState } from 'react'
+import { useRef, useState } from 'react'
6
import { Field } from './useField'
7
import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect'
8
import type {
@@ -189,7 +189,11 @@ export function useForm<
189
TSubmitMeta
190
>,
191
) {
192
- const formId = useRef(opts?.formId ?? uuid())
+ const formId = useRef<string>(opts?.formId as never)
193
+
194
+ if (!formId.current) {
195
+ formId.current = uuid()
196
+ }
197
198
const [formApi] = useState(() => {
199
const api = new FormApi<
0 commit comments