fix(deps): update dependency react-final-form to v6
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| react-final-form | 4.1.0 -> 6.5.9 |
Release Notes
final-form/react-final-form
v6.5.9
- Added React 18 to peer dependencies (#982)
v6.5.8
v6.5.7
Type Fixes
v6.5.6
Oops. My mistake.
- Remove engines from package.json #945
v6.5.5
Apologies... FF v4.20.3 contained an engines value in package.json that broke some builds.
- Skipped FF 4.20.3 for 4.20.4 #945
v6.5.4
Bug Fixes
- Use custom hook to create callback constants #933
- Use each item inside of decorators to allow decorators to change identity #893
- Stabilize useField public handler identity #931 #816
Type Fixes
v6.5.3
Examples Fixes only
v6.5.2
🎉 Support for React 17 as a peer dep! 🎉
Bug Fixes
Type Fixes
- Apply generic types to params in useFormState declaration #841
- Allow custom props in
FormProps#867 #864
v6.5.1
Hi, @erikras here. The primary reason for this update is to remove the Scarf dependency. I already did for Final Form and I thought React Final Form did not have its own dependency, but I was mistaken. Apologies for the delay.
You can read about my feelings about Scarf here:
Open Source Sustainability
Deps Fixes
- Remove scarf dep #831
Bug Fixes
- Update auto-save-selective-debounce to handle clearing inputs #802
- Re-initialize onFocus/onBlur handlers if the subscribed field changes #787
Type Fixes
- Update
FormValuesTypescript definition #806
v6.5.0
New Features
- 🎉🎉 Forward refs to input component 🎉🎉 #608 #141
- Add
modifiedSinceLastSubmitflag to form and field state #799
Bug Fixes
- Deduce select type from component prop for select-multiple #793
- If name prop is passed as
undefinedto Field component, an error is thrown #777 #450
v6.4.0
As of React v16.13.0, there has been a warning in React Final Form, Redux Form, and Formik. You can read @gaearon's explanation of it here: https://github.com/facebook/react/issues/18178#issuecomment-595846312
This release, in conjunction with [email protected], fixes this warning.
Technically, a peer dependency change should be a major, breaking change, but these two libraries are so tightly coupled, that I'm only making it a "minor" update. Shout at @erikras on Twitter if this upsets you.
Bug Fix
v6.3.5
Bug Fix
- Update
keepDirtyOnReinitializebefore initial values #706 https://github.com/final-form/final-form/pull/311
v6.3.4
Bug Fixes
- Add data object to useField/Field #711
- Submit edge case fix #697 #695
- Add missing dirtyFieldsSinceLastSubmit to getters #688
Typing Fixes
- Add otherProp to FieldRenderProps interface #716 #398
- Fix handleSubmit typings #715 #86
- Improved type definition for Field #708
- Added note about the return type of handleSubmit #681 #675
v6.3.3
Typing Fixes
v6.3.2
v6.3.1 introduced a bug. v6.3.2 fixes it.
Bug Fixes
v6.3.1
Bug Fixes
- Fixed decorators unsubscribe order #620 #618
- Fix issue with inline
isEqualcausing an infinite rerender loop #603 #517 - Lazy evaluation of form and field state #596
- Fix async act warning #581
- Pausing validation before unmount #595 #408
- Fixed bug with ignoring changes to
onChange#572 #569 - Pass any additional props to custom component #565 #175
- Pass through
multiplevalue to custom components #545 #544 - Cleanup
onBlurdependencies #546 - Do not pass undefined type to input #548
Typing Fixes
- Fix useFormState and useField Flow types #630
- Add RenderableProps to FormRenderProps #575
- Fix typescript typings in FieldProps #619
- Fix
FormProps['decorators']#629 - Pass FormValues type to Decorator #661
- FieldInputProps extends AnyObject #606
- Remove Omit from the typescript definitions #589
- Allow typed render props in TS #570
Build Fixes
- Remove the version #604
v6.3.0
New Features
- Support for Final Form's new
validatingflag. Requires[email protected]. #541
Bug Fixes
v6.2.1
Whilst it could be argued that updating a peer dependency is a "breaking change" – and it would be if it were on a large third party library, like React – it is the opinion of the library author that, due to the tight coupling between final-form and react-final-form, such a change, especially just for type definitions, is acceptable, even in a "patch" release. Feel free to yell at @erikras on Twitter if you vehemently disagree.
Type Updates
- Updated to [email protected] to get typed FieldState
ab2e970
v6.2.0
TypeScript fixes
- Use the same default for FormValues type in all declared types (#525)
- Replace empty object default type with any object (#526)
- Refactor getContext back to a simple context file (#524)
New Features
- Strongly typed field values (#530)
- Added tsx generic typings for Field, Form, and FormSpy components (#522)
For Typescript users, you can take advantage of JSX Generics, so you can specify the type of your form values or field value directly in the JSX call to Form, Field, or FormSpy. For Form, it will even infer the form values type if you provide initialValues.
Behold this code:
interface MyValues {
firstName: string
lastName: string
}
const initialValues: MyValues = {
firstName: 'Erik',
lastName: 'Rasmussen'
}
const onSubmit = (values: MyValues) => {
ajax.send(values)
}
{/*
Typescript will complain if the type of initialValues is not
the same as what is accepted by onSubmit
*/}
<Form onSubmit={onSubmit} initialValues={initialValues}>
{({ handleSubmit, values }) => {
// 💥 Type of values is inferred from the type of initialValues 💥
return (
<form onSubmit={handleSubmit}>
{/* 😎 Field values are strongly typed using JSX generics 😎 */}
<Field<string> name="firstName" component={TextInput} />
<Field<string> name="lastName" component={TextInput} />
<Field<number> name="age" component={NumberInput} />
<button type="submit">Submit</button>
</form>
)
}}
</Form>
v6.1.0
New Features
- Allowed swappable final-form APIs #520
- 💥 Strongly typed form values for Flow and Typescript 💥 #516
Usage:
import { withTypes, Field } from 'react-final-form'
type MyValues = {
email: string,
password: string
}
const { Form } = withTypes<MyValues>()
<Form onSubmit={onSubmit}>
{({ handleSubmit, values }) => {
// values are of type MyValues
}}
</Form>
Housekeeping
v6.0.1
Bug Fixes
Type Fixes
- Fix Flow typings for
UseFieldConfigandFieldProps#503 - Added back flow types that got removed #505 #500
- Update Types to make useField's options optional #499
v6.0.0
This release contains very minimal, edge-case, breaking changes.
Bug Fixes
- Fixed bug in form component rerendering not responding to changes in form state properly. #498 #487 #492
⚠️ Breaking Changes ⚠️
-
Subscription changes will now be ignored. For some reason previous versions of React Final Form did extra work to allow you to change the
subscriptionprop, causing the component to reregister with the Final Form instance. That is a very rare use case, and it was a lot of code to enable it. If you need to change your subscription prop, you should also change thekeyprop, which will force the component to be destroyed and remounted with the new subscription. -
parse={null}andformat={null}are no longer allowed. That was a bad choice of API design, which is probably why Flow doesn't allow theFunction | nullunion type. #400 Passingnullserved the purpose of disabling the defaultparseandformatfunctionality. If you need to disable the existingparseandformat, you can pass an identity function,v => v, toparseandformat.
< v6
<Field name="name" parse={null} format={null}/>
>= v6
const identity = v => v
...
<Field name="name" parse={identity} format={identity}/>
v5.1.2
v5.1.1
Bug Fixes
- Add state.change to useField's onChange dependencies. #477
- Make flattenSubscription hooks-safe #479
Type Fixes
- add beforeSubmit and afterSubmit to typescript def #484
- Add simple test for generic FieldRenderProps type #439
- Tweak useFormState TS types #482 #476
- Adjust ts definitions #486
v5.1.0
New Features
- Used [email protected]'s new
beforeSubmitcallback to enableformatOnBlurbefore submit #478 #470
v5.0.2
Bug Fixes
v5.0.1
🤦♂️
- Actually changed peerDep to React 16.8
99cef7d
v5.0.0
🎉 v5.0.0 – HOOKS!!! 🎉
First to explain why this change was made... To manage subscriptions to the internal 🏁 Final Form instance, 🏁 React Final Form has been using some legacy lifecycle methods that make the side effect of subscribing to an event emitter cumbersome. Such subscriptions are a perfect use case (no pun intended) for the new React.useEffect() hook. In an effort to modernize and future proof the library, the entire thing has been rewritten to use hooks.
All the previous tests have been rewritten to use 🐐 React Testing Library, which is a superior way to test React components. None of the tests were removed, so all existing functionality from v4 should work in v5, including some optimizations to minimize superfluous additional renders that were made possible by hooks.
⚠️ BREAKING CHANGES 😮
Don't worry...there really aren't that many.
- Requires
^[email protected]. That's where the hooks are. 🙄 - All deprecated functions provided in
FormRenderPropsandFormSpyRenderPropshave been removed. They have been spitting warnings at you sincev3, so you've probably already corrected for this. The following applies to:-
batch -
blur -
change -
focus -
initialize -
mutators -
reset
-
Rather than spreading the FormApi into the render props, you are just given form itself.
v4
<Form onSubmit={submit}>{({ reset }) => (
// fields here
<button type="button" onClick={reset}>Reset</button>
)}</Form>
v5
<Form onSubmit={submit}>{({ form }) => (
// fields here
<button type="button" onClick={form.reset}>Reset</button>
)}</Form>
-
Fieldwill no longer rerender when thevalidateprop. Note: it will still always run the latest validation function you have given it, but it won't rerender when the prop is!==. This is to allow the very common practice of providing an inline=>function as a field-level validation function. This change will break the very rare edge case where if you are swapping field-level validation functions with different behaviors on subsequent renders, the field will no longer rerender with the new validation errors. The fix for this is to also change thekeyprop onFieldany time you swap thevalidatefunction. See this test for an example of what I mean. There's also a sandbox demonstrating the issue:
- The previously exported
withReactFinalFormHOC has been removed. Now you should use theuseForm()hook if you'd like to get the 🏁 Final Form instance out of the context. To ease your transition, you can make your own with a single line of code:
const withReactFinalForm = Component => props =>
<Component reactFinalForm={useForm()} {...props} />
😎 New Hook API 😎
Because it was so easy to do, 🏁 React Final Form now exports the useField and useFormState hooks that are used internally in Field and FormSpy respectively. Literally the only thing Field and FormSpy do now is call their hook and then figure out if you are trying to render with the component, render, or children prop.
For example, before v5, if you wanted to create a custom error component that only rerendered when touched or error changed for a field, you'd have to do this:
v4
const Error = ({ name }) => (
<Field name={name} subscription={{ touched: true, error: true }}>
{field =>
field.meta.touched && field.meta.error ? (
<span>{field.meta.error}</span>
) : null
}
</Field>
)
...but now you can do:
v5
const Error = ({ name }) => {
const field = useField(name, { subscription: { touched: true, error: true } })
return field.meta.touched && field.meta.error ? (
<span>{field.meta.error}</span>
) : null
}
Not too groundbreakingly different, but these hooks might allow for some composability that was previously harder to do, like this ~clever~ disgusting hack to listen to multiple fields at once.
Go forth and hook all the things! 🎣
Special thanks to @Andarist for giving me such an extensive code review on #467.
Configuration
📅 Schedule: Branch creation - "before 3am on Monday" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
- [ ] If you want to rebase/retry this PR, check this box
This PR has been generated by Mend Renovate. View repository job log here.