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 Meta Values Not Influencing Derived Data #1036

Open
crutchcorn opened this issue Nov 25, 2024 · 1 comment
Open

Default Meta Values Not Influencing Derived Data #1036

crutchcorn opened this issue Nov 25, 2024 · 1 comment
Labels

Comments

@crutchcorn
Copy link
Member

This test fails:


  it('should have derived state on first render given defaultMeta', () => {
    const form = new FormApi({
      defaultValues: {
        name: '',
      },
    })
    form.mount()

    const nameField = new FieldApi({
      form,
      name: 'name',
      defaultMeta: {
        errorMap: {
          onChange: 'THERE IS AN ERROR',
        },
      },
    })

    nameField.mount()
    expect(nameField.getMeta().errors).toEqual(['THERE IS AN ERROR'])
  })

Because onUpdate only triggers when you actually update the state, not in the constructor.

@crutchcorn crutchcorn added the bug label Nov 25, 2024
@crutchcorn
Copy link
Member Author

When finished, #1036 will solve these kinds of problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant