Changelog History
Page 2
-
v6.2.1 Changes
June 14, 2019Whilst 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
andreact-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 Changes
June 14, 2019π TypeScript fixes
- 0οΈβ£ Use the same default for FormValues type in all declared types (#525)
- 0οΈβ£ 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
, orFormSpy
. ForForm
, it will even infer the form values type if you provideinitialValues
.Behold this code:
interface MyValues { firstName: stringlastName: 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 Changes
June 11, 2019π 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 Changes
May 29, 2019 -
v6.0.0 Changes
May 27, 2019π 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
subscription
prop, 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 thekey
prop, 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 | null
union type. #400 Passingnull
served the purpose of disabling the defaultparse
andformat
functionality. If you need to disable the existingparse
andformat
, you can pass an identity function,v => v
, toparse
andformat
.
< v6
\<Field name="name" parse={null} format={null}/\>
>= v6
const identity = v =\> v...\<Field name="name" parse={identity} format={identity}/\>
-
v5.1.2 Changes
May 24, 2019