Skip to content

Commit 7f2a824

Browse files
committed
v1.1.1
1 parent e0017c6 commit 7f2a824

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ const MyForm = () => (
116116
* [Submission Errors](#submission-errors)
117117
* [Third Party Components](#third-party-components)
118118
* [💥 Performance Optimization Through Subscriptions 💥](#-performance-optimization-through-subscriptions-)
119+
* [Loading and Initializing Values](#loading-and-initializing-values)
119120
* [Field Arrays](#field-arrays)
120121
* [Rendering](#rendering)
121122
* [API](#api)
@@ -230,6 +231,11 @@ Yet, if some part of form state is needed inside of it, the
230231
[`FormSpy`](#formspy--reactcomponenttypeformspyprops) component can be used to
231232
attain it.
232233

234+
### [Loading and Initializing Values](https://codesandbox.io/s/91w9ro3x9o)
235+
236+
Demonstrates how a form can be initialized, after fetching data, by passing in
237+
`initialValues` as a prop.
238+
233239
### [Field Arrays](https://codesandbox.io/s/kx8qv67nk5)
234240

235241
Demostrates how to use the `<FieldArray/>` component, from

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-final-form",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description":
55
"🏁 High performance subscription-based form state management for React",
66
"main": "dist/react-final-form.cjs.js",

src/ReactFinalForm.test.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ describe('ReactFinalForm', () => {
219219
expect(renderInput).toHaveBeenCalledTimes(2)
220220
expect(renderInput.mock.calls[1][0].input.value).toBe('bar')
221221
})
222-
222+
223223
it('should return a promise from handleSubmit when submission is async', async () => {
224224
const onSubmit = jest.fn()
225225
let promise
@@ -303,5 +303,18 @@ describe('ReactFinalForm', () => {
303303
expect(validate).toHaveBeenCalledTimes(3)
304304
// never called again because it was never invalid
305305
expect(renderInput).toHaveBeenCalledTimes(1)
306+
307+
onFocus()
308+
expect(validate).toHaveBeenCalledTimes(3)
309+
expect(renderInput).toHaveBeenCalledTimes(1)
310+
311+
// back to invalid
312+
onChange('1')
313+
expect(validate).toHaveBeenCalledTimes(3)
314+
expect(renderInput).toHaveBeenCalledTimes(1)
315+
316+
onBlur() // NOW should be invalid
317+
expect(validate).toHaveBeenCalledTimes(4)
318+
expect(renderInput).toHaveBeenCalledTimes(2)
306319
})
307320
})

0 commit comments

Comments
 (0)