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

Issues on migrating from final-form to @tanstack/react-form #1052

Open
douglasjunior opened this issue Dec 3, 2024 · 0 comments
Open

Issues on migrating from final-form to @tanstack/react-form #1052

douglasjunior opened this issue Dec 3, 2024 · 0 comments

Comments

@douglasjunior
Copy link

douglasjunior commented Dec 3, 2024

Describe the bug

I'm trying to migrate from final-form to @tanstack/react-form, but I struggled with some issues that I cant figure out how to solve at the moment.

  1. The first one may be a bug, but form.state.isValid starts with true even with invalid fields.

    Maybe related to canSubmit in form is true even if some fields are unvalid #358

    This can be reproduced even in the CodeSandbox example: https://codesandbox.io/p/devbox/boring-dust-crdfdk

    It's important to mention that I can't force the form submission or field validation because we need to keep the field as isTouched = false.

  2. Focused state in the field

    Final-form has a meta in the field to indicate that this field is on focus, in the same context, the form has an array indicating the focused fields.

    This is useful to handle some situations in complex screens and also to highlight components.

    Today the @tanstack/react-form only handles the blur event to update the isTouched state.

Your minimal, reproducible example

https://codesandbox.io/p/devbox/boring-dust-crdfdk

Steps to reproduce

Just render the app and take a look at the Form status.

Expected behavior

When the form mounts, the validations must be run to allow the form to update the isValid state.

How often does this bug happen?

Every time

Screenshots or Videos

Initial render:

Image

After blurring the field:

Image

After submit:

Image

Platform

  • OS: MacOS
  • Browser: Chrome
  • Version: Latest

TanStack Form adapter

react-form

TanStack Form version

0.37.1

TypeScript version

5.3.3

Additional context

No response

@douglasjunior douglasjunior changed the title Migrating from final-form to @tanstack/react-form Issues on migrating from final-form to @tanstack/react-form Dec 3, 2024
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