vaadin / hilla

Build better business applications, faster. No more juggling REST endpoints or deciphering GraphQL queries. Hilla seamlessly connects Spring Boot and React to accelerate application development.
https://hilla.dev
Apache License 2.0
922 stars 58 forks source link

Validation message is not working as expected in 2.0 #871

Open marcushellberg opened 1 year ago

marcushellberg commented 1 year ago

Description of the bug

After updating to 2.0, my app shows validation errors like this, instead of just the message

Screenshot 2023-03-31 at 12 50 04

Minimal reproducible example

Bind a field to a Java property marked @NotBlank

Expected behavior

Only the error message is shown, as in 1.x

Actual behavior

A more verbose message is shown, making it more difficult to see the actual message

Versions:

- Vaadin / Hilla version: 2.0.2
cromoteca commented 1 year ago

This is a bug in the regexp used to match the whole message and get the needed information to be shown in the interface: https://github.com/vaadin/hilla/blob/1c073562b8ccc84029a4d6599e7b499724adde62/packages/ts/form/src/Binder.ts#L183-L186

The value being empty here, the expression does not match.

This definitely a bug, but I doubt that it is related to 2.0: I see the same regexp in 1.x.

platosha commented 1 year ago

Seems not related with 2.0 indeed. It did not manifest earlier, as normally there is an error from the client-side validation instead with a correct message.

There was a related issue with 2.0 with the client-side validation (see https://github.com/vaadin/hilla/issues/830), that made this one visible. That issue was fixed, but let us fix this one anyway.