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

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

Open
jozefmery opened this issue Dec 28, 2023 · 1 comment
Open

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

jozefmery opened this issue Dec 28, 2023 · 1 comment

Comments

@jozefmery
Copy link

jozefmery commented Dec 28, 2023

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.

@Roanmh
Copy link

Roanmh commented Jan 16, 2024

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.

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

2 participants