New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
π―ββοΈ support async defaultValues
and form values
update
#9261
Conversation
Β Open in CodeSandbox Web Editor | VS Code | VS Code Insiders |
values
prop
Size Change: +148 B (+1%) Total Size: 18.7 kB
|
defaultValues
and form values
update
@bluebill1049 Thanks so much for this! We have a great use case for this. I'm running the canary and having trouble getting this working with Apollo's Can we explore Apollo use cases as part of this effort? |
hey @tcschiller you can use https://twitter.com/HookForm/status/1593066930579333120 Going to release another patch to improve type inference and improve
|
β¦type" This reverts commit 362f369.
- change tsd script to run test:type - added more type test coverage for promise infer
- fix build
- update api extrator
- fix import * as react
- remove inline sleep function
Context
This PR is aimed to improve both UX and DX with form values update.
useEffect
andreset
combination, eg:Proposal Syntax
π NEW
values
propsThe following syntax will react to
values
prop update/changes.π NEW async
defaultValues
propsThe following syntax will support async
defaultValues
, so we will manage thereset
form internally and updateformState
accordingly.useForm()
callresetOptions
as wellReact
use
APIRFC
π What's the difference between
values
anddefaultValues
values
will react to changes and reflect on the form values, anddefaultValues
is cached for once and will never re-run the promise or react todefaultValues
changes.TODO:
defaultValues