-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix array error overwriting * Changeset * User error merge in form submit * Remove imports
- Loading branch information
Showing
6 changed files
with
86 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@reactive-forms/core': patch | ||
--- | ||
|
||
Fixed bug when error set on array type was overwritten by errors from any item in array (error object was replaced with array) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import isPlainObject from 'lodash/isPlainObject'; | ||
import mergeWith from 'lodash/mergeWith'; | ||
|
||
const errorsMergeCustomizer = (target: unknown, source: unknown): unknown => { | ||
if (Array.isArray(target) && isPlainObject(source)) { | ||
return mergeWith(target, Object.assign([], source), errorsMergeCustomizer); | ||
} | ||
if (Array.isArray(source) && isPlainObject(target)) { | ||
return mergeWith(source, Object.assign([], target), errorsMergeCustomizer); | ||
} | ||
}; | ||
|
||
export const mergeErrors = (target: unknown, ...sources: unknown[]) => | ||
mergeWith(target, ...sources, errorsMergeCustomizer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters