error-message icon indicating copy to clipboard operation
error-message copied to clipboard

root.* error support

Open ViieeS opened this issue 2 years ago • 1 comments

The component doesn't support new root.* error type, eg name="root.serverError"

Type '"root.serverError"' is not assignable to type FormData

ViieeS avatar Mar 01 '23 17:03 ViieeS

I ran into the same issue today.

In my case I set a custom error that got returned from the server after submitting a form:

setError("root.failure", {
    type: data.failure.reason,
});

I expected the following code to display the error message for root.failure, but it didn't:

<ErrorMessage errors={errors} name="root.failure" />

Instead, not using ErrorMessage component in this case worked:

<p>{errors.root?.failure?.type}</p>

bitmensch avatar Jul 03 '23 08:07 bitmensch