Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dot syntax names #48

Closed
steveoh opened this issue Mar 4, 2021 · 0 comments
Closed

dot syntax names #48

steveoh opened this issue Mar 4, 2021 · 0 comments

Comments

@steveoh
Copy link

steveoh commented Mar 4, 2021

It appears that

<input name="coordinate.northing" ref={register} />
<ErrorMessage errors={errors} name="coordinate.northing" />

does not function properly. Is this known/expected?

I noticed this test

it('should render correctly with nested errors object', () => {
const { asFragment } = render(
<ErrorMessage
errors={{
nested: {
object: { type: 'object', message: 'object' },
},
}}
name="nested.object"
/>,
);
expect(asFragment()).toMatchSnapshot();
});

But I don't see the same result.

Maybe this is an issue for the main repo since the errors object sent to this component contains

{
 northing: {message: '', type: ''}
}

updating the error message to

<ErrorMessage errors={errors} name="northing" as={ErrorMessageTag} />

does work but that is confusing and can lead to non-unique keys.

update

I messed up. the errors object is coming from my yup resolver schema so once I linked everything up it does work as expected.

@steveoh steveoh closed this as completed Mar 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant