Skip to content

Commit

Permalink
Merge pull request #94 from 10xjs/fix-deep-focus
Browse files Browse the repository at this point in the history
Fix touched and visited values for deep paths
  • Loading branch information
10xjs authored Oct 1, 2019
2 parents abfec25 + d1c519a commit 78f4548
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/useField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ const updateFieldState = <FV, FE, FW>(
let nextState = state;

const focused = formState.focusedPath === formattedPath;
const visited = !!get(formState.visitedMap, parsedPath);
const touched = !!get(formState.touchedMap, parsedPath);
const visited = !!get(formState.visitedMap, [formattedPath]);
const touched = !!get(formState.touchedMap, [formattedPath]);

const value = get(formState.values, parsedPath) as FV;
const pendingValue = get(formState.pendingValues, parsedPath) as FV;
Expand Down
4 changes: 2 additions & 2 deletions src/useFieldStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export const updateFieldStatus = <FV extends any>(
let nextState = state;

const focused = formState.focusedPath === formattedPath;
const visited = !!get(formState.visitedMap, parsedPath);
const touched = !!get(formState.touchedMap, parsedPath);
const visited = !!get(formState.visitedMap, [formattedPath]);
const touched = !!get(formState.touchedMap, [formattedPath]);

const value = get(formState.values, parsedPath) as FV;
const pendingValue = get(formState.pendingValues, parsedPath) as FV;
Expand Down

0 comments on commit 78f4548

Please sign in to comment.