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

Default value priority #68

Open
cipriancaba opened this issue Mar 26, 2024 · 0 comments
Open

Default value priority #68

cipriancaba opened this issue Mar 26, 2024 · 0 comments

Comments

@cipriancaba
Copy link
Contributor

I've hit a situation where I define the values in the schema, which is stored in a static file, but I want to override the default values via fieldConfig.inputProps which I feel should get priority

I would suggest the following change here:

Instead of

if (
        (defaultValue === null || defaultValue === "") &&
        fieldConfig?.[key]?.inputProps
      ) {
        defaultValue = (fieldConfig?.[key]?.inputProps as unknown as any)
          .defaultValue;
      }

I would change this to:

if ((fieldConfig?.[key]?.inputProps as unknown as any)?.defaultValue) {
        defaultValue = (fieldConfig?.[key]?.inputProps as unknown as any)
          .defaultValue
      }

This way the inputProps will get the highest prio and override the schema default value. What do you think @vantezzen ?

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