Skip to content

Commit

Permalink
Fixed regex for getFieldError for nested object.
Browse files Browse the repository at this point in the history
  • Loading branch information
webblocksapp committed Nov 21, 2022
1 parent 848679d commit fdb766e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/lib/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "solid-form-handler",
"description": "A SolidJS library for simplifying form validations.",
"version": "1.0.0-alpha.4",
"version": "1.0.0-alpha.5",
"license": "MIT",
"keywords": [
"SolidJS forms",
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/src/hooks/useFormHandler/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ export const useFormHandler = <T = any>(validationSchema: ValidationSchema<T>, o
* Extracts the error message from the fieldState according to the given path.
*/
const getFieldError = (path: string = ''): string => {
return path && findErrorMessages(path).join(', ').replace(/,$/, '').replace(/^,/, '');
return path && findErrorMessages(path).join(', ').replace(/,\s$/, '').replace(/^,\s/, '');
};

/**
Expand Down

0 comments on commit fdb766e

Please sign in to comment.