Skip to content
This repository was archived by the owner on Aug 23, 2022. It is now read-only.

Commit 460d94f

Browse files
committed
Merge branch 'master' of github.com:davidkpiano/react-redux-form
2 parents 0e788cb + 21652dd commit 460d94f

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

docs/api/Control.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ _(Boolean)_: Signifies that the field state (validation, etc.) should not persis
369369
## `getValue={(event, props) => ...}` {#prop-getValue}
370370
_(Function)_: Determines the value given the `event` (from `onChange`) and optionally the control component's `props`.
371371

372-
By default, the `getValue` function returns the value by hecking if the `event` is a DOM event.
372+
By default, the `getValue` function returns the value by checking if the `event` is a DOM event.
373373
- If so, it returns `event.target.value`
374374
- If not, it returns the `event`.
375375

src/reducers/form-actions-reducer.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,13 @@ export function createFormActionsReducer(options) {
265265
retouched: false,
266266
};
267267

268+
subFieldUpdates = {
269+
pending: action.pending,
270+
submitted: false,
271+
submitFailed: false,
272+
retouched: false,
273+
};
274+
268275
parentFormUpdates = { pending: action.pending };
269276

270277
break;
@@ -361,9 +368,11 @@ export function createFormActionsReducer(options) {
361368
// If the form is invalid (due to async validity)
362369
// but its fields are valid and the value has changed,
363370
// the form should be "valid" again.
364-
if ((!parentForm.$form.validity
365-
|| !parentForm.$form.validity
366-
|| !Object.keys(parentForm.$form.validity).length)
371+
const validityIsBool = typeof parentForm.$form.validity === 'boolean';
372+
const isInvalid = validityIsBool
373+
? !parentForm.$form.validity
374+
: !Object.keys(parentForm.$form.validity).length;
375+
if (isInvalid
367376
&& !parentForm.$form.valid
368377
&& isValid(parentForm, { async: false })) {
369378
return {

test/form-reducer-actions-spec.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,9 @@ describe('formReducer() (V1)', () => {
255255
...initialFieldState,
256256
retouched: true,
257257
},
258+
name: {
259+
...initialFieldState,
260+
},
258261
},
259262
expectedForm: {
260263
pending: true,
@@ -265,6 +268,12 @@ describe('formReducer() (V1)', () => {
265268
submitFailed: false,
266269
retouched: false,
267270
},
271+
expectedSubField: {
272+
pending: true,
273+
submitted: false,
274+
submitFailed: false,
275+
retouched: false,
276+
},
268277
},
269278
],
270279
[actionTypes.SET_VALIDITY]: [

0 commit comments

Comments
 (0)