Skip to content

Conversation

jorisre
Copy link
Member

@jorisre jorisre commented Mar 16, 2025

closes #12686

@jorisre jorisre requested a review from bluebill1049 March 16, 2025 08:37
@jorisre jorisre changed the title fix: improve type inference for useFormContext fix: type inference for useFormContext Mar 16, 2025
Copy link
Contributor

github-actions bot commented Mar 16, 2025

Size Change: 0 B

Total Size: 53.9 kB

ℹ️ View Unchanged
Filename Size
dist/index.cjs.js 10.7 kB
dist/index.esm.mjs 19.8 kB
dist/index.umd.js 10.8 kB
dist/react-server.esm.mjs 12.7 kB

compressed-size-action

Copy link
Member

@bluebill1049 bluebill1049 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @jorisre LGTM!

@bluebill1049 bluebill1049 merged commit cbd9fc6 into master Mar 16, 2025
5 checks passed
@bluebill1049 bluebill1049 deleted the fix/use-form-context-type-inference branch March 16, 2025 11:43
bluebill1049 added a commit that referenced this pull request Apr 21, 2025
bluebill1049 added a commit that referenced this pull request Jul 5, 2025
* feat: compute prop for useWatch subscription

* clean up initialValue

* update api

* update with unit test

* 👁️ feat: improve reference update with useWatch (#12537)

* feat: improve reference update with useWatch

* update pai extrator

* Revert "update pai extrator"

This reverts commit 0b3bbd3.

* Revert "feat: improve reference update with useWatch"

This reverts commit a664a68.

* update form value reference at consumer isntead usewatch

* update api extrator

* 🐞 fix #12532 useController should unregister issue with strict mode (#12538)

* 7.55.0-next.3

* ⏰ chore: remove __typetest__ folder from build (#12555)

* 🐞 fix useController should unregister issue with strict mode

* chore: remove __typetest__ folder from build

* 🏈 chore: upgrade app and automation deps (#12556)

* chore: upgrade app and automation deps

* update app lock

* revert app package

* 🦾 feat: reference stable for useWatch defaultValue (#12564)

* feat: reference stable for useWatch defaultValue

* remove as

* 🐞 fix #12572 disabled field value not get undefined in resolver (#12573)

* 🐞 fix #12572 disabled field value not get undefined in resolver

* fix resolver data issue

* 7.55.0-next.4

* ❤️ update readme footer for Vercel documentation sponsorship

* 📜 update README.md move banner to the bottom (#12604)

* 😌 close #12606 update package.json author field (#12608)

* 🐞 fix #12580 valid state update with onBlur mode (#12612)

* 🐞 fix #12580 valid state update with onBlur mode

* update e2e

* 🛟 fix: add condition to prevent infinite render (#12622)

* fix: add condition to prevent infinite render

* fix: revert pnpm-lock.yaml changes, and use a utility function instead of typing code manually

* Revert "fix: revert pnpm-lock.yaml changes, and use a utility function instead of typing code manually"

This reverts commit b86e660.

* Revert "fix: add condition to prevent infinite render."

This reverts commit 51105a6.

* fix: use a utility function instead of typing code manually

* 7.55.0-next.5

* 🐞 fix #12580 `setError` in `useEffect` does not work when used inside the `FormProvider` context (#12642)

* 🐞 fix #12632 use useLayoutEffect instead of useEffect to subscribe components earlier than before

* 🧪 test(useFieldArray): Update the result array to reflect the outcomes of the modified logic

* 🧪 test(setError): “Add a test case for using setError within the useEffect callback in FormProvider as mentioned in the issue

* 🦥 close #12634 allow components with `useController` hook be memoized (#12635)

* add test scenario for #12634

* fix(useForm): set `values` immediately on first render

* 🐞 fix #12631 revalidateMode issue with useFieldArray validation (#12646)

* 🚠 upgrade deps and ts to 5.8.0 (#12647)

* upgrade deps and ts to 5.8.0

* app deps upgrade

* update prettier

* Revert "app deps upgrade"

This reverts commit aaabc46.

* update pnpm lock

* 🫡 allow use of `handleSubmit` with native events (#12645)

* Allow use of handleSubmit with native events

* Run API Extractor

---------

Co-authored-by: Beier (Bill) <[email protected]>

* 7.55.0-next.6

* 🐞 fix #12665 regression on values over take default values

* 7.55.0-next.7

* 🥹 close #12665 issue with values not populate form

* 🐞 fix(useForm): make `values` and `defaultValues` work correctly with `createFormControl` and `useMemo` (#12675)

* Revert "🐞 fix #12665 regression on values over take default values"

This reverts commit ef80ff6.

* Revert "🥹 close #12665 issue with values not populate form"

This reverts commit d9e7e4d.

* test: add test case for #12665

* fix(vscode): fix running individual tests and debugging

* test: verify setting values doesn't unregister fields

* fix(createFormControl): don't unregister fields on reset

* fix(useForm): set default values if given along with a form control

Fixes #12665 .

* 👮‍♂️ feat: infer resolver output types (#12638)

* Allow resolver output type to truly differ (#11951)

* Default TTransformedValues to TFieldValues without constraint

This allows for resolvers to parse to a different type that doesn't have to have
the same shape as TFieldValues.

This commit contains type-only changes. No runtime changes are introduced.

* Tests for TTransformedValues change

Test that `useWatch` returns `TFieldValues` values, not `TTransformedValues`
ones.

Test that `TTransformedValues` are submitted on success and `TFieldValues` on
failure.

* Add type test for useForm inference

From: https://github.com/react-hook-form/react-hook-form/pull/11913/files

---------

Co-authored-by: Beier (Bill) <[email protected]>

* feat: add automatic output type inference from resolver functions

* fix: resolvers type inference

* chore: api extractor

* test build

* Revert "test build"

This reverts commit 16e5661.

---------

Co-authored-by: Jeremy Hughes <[email protected]>
Co-authored-by: Beier (Bill) <[email protected]>

* 7.55.0-next.8

* ⚽️ chore: update prettier configuration and apply formatting (#12650)

Co-authored-by: Beier (Bill) <[email protected]>

* 🪲 fix #12680: Update Fieldarray Unmount Status (#12690)

* 🫡 fix: improve type inference for `useFormContext` (#12689)

Co-authored-by: Beier (Bill) <[email protected]>

* 7.55.0-next.9

* 7.55.0

* 🐞 fix: use `useIsomorphicLayoutEffect` to address warning in SSR (#12738)

* ⏰ feat: introduce `isReady` state for subscription (#12568)

* faet: introduce ready state for subscription

* revert change

* save code

* save code

* code consistency

* change to part of formState

* update all unit tests

* update api contract

* update e2e

* fix two more

* update more e2e tests

* remove two blur counter

* fix issue caught by unit tests

* one last e2e test to fix

* update all e2e

* 🌗 feat: support reactive `mode` and `reValidateMode` (#12743)

* feat: support reactive mode and reValidateMode

* minor cleanup

* 🦁 update app deps (#12746)

* wip

* 🐞 fix #12741 regression on move/swap on useFieldArray input update (#12749)

* 🐞 fix #12741 regression on move/swap on useFieldArray input update

* remove unsed code

* simplify the code

* update useFromState

* fix e2e tests

* 7.56.0-next.0

* 7.56.0

* improve other hooks

* update api

* change to useEffect

* rename to consistent value

* update type

* update api contractor

* feat: improve useWatch type when compute prop is specified (#12771)

* Update eslint.config.mjs

* update version

* Revert "update version"

This reverts commit a2711ac.

* 7.57.0-next.0

* update function overload order

* update api contractor

---------

Co-authored-by: KimJunYoung <[email protected]>
Co-authored-by: Jacek Tomaszewski <[email protected]>
Co-authored-by: Josh Kelley <[email protected]>
Co-authored-by: Joris <[email protected]>
Co-authored-by: Jeremy Hughes <[email protected]>
Co-authored-by: HoberMin <[email protected]>
Co-authored-by: David <[email protected]>
Co-authored-by: Kotaro Sugawara <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

issue: next.8 handleSubmit on useFormContext does not infer types of data correctly
2 participants