remix-forms icon indicating copy to clipboard operation
remix-forms copied to clipboard

[BUG] Field error(s) not showing if using additional component

Open jozefmery opened this issue 2 years ago • 1 comments

Bug description

Hi, I recently integrated this library into my stack and I stumbled upon a wierd issue. I attempted to clean up my code by decomposing certain complex fields into their own functions to keep the code readable, but due to this, schema errors are not shown anymore. I did some investigation and it seems that the react-hook-form library is aware of the error, but for some reason, the message is not displayed. The (I believe) exact same code works if the definition is in-line.

The decomposition I went with is very simple, but feels "hacky" in the context of this library as I needed to extract the correct typing as follows:

type FormRenderProperties<Schema extends FormSchema> = Parameters<NonNullable<FormProps<Schema>["children"]>>[0];,

as the Children type is not exported.

Reproduction

Minimal issue reproduction repo (using Vite): repr, relevant file

Final notes

I may have chosen inappropriate means for cleanup, but I did not manage to find an example that showcases any decomposition, or field re-usability.

Despite some quirks, this is a great library and I would like to thank the authors for sharing it.

jozefmery avatar Dec 28 '23 16:12 jozefmery

I am currently having the same issue. I'll note that the problem persisted for me when I used any in my reproduction, with the same results.

Roanmh avatar Jan 16 '24 16:01 Roanmh

Hi @jozefmery , sorry for the late answer but I'm cleaning and fixing some issues around here and your files are not available anymore. I'll be closing the issue as we've added a bunch of changes and the problem might have gone already. Feel free to reopen it in case you think this is still an issue!

gustavoguichard avatar Jan 08 '25 14:01 gustavoguichard