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

Thomas/update conform #499

Merged
merged 2 commits into from
Jul 22, 2024
Merged

Thomas/update conform #499

merged 2 commits into from
Jul 22, 2024

Conversation

balzdur
Copy link
Collaborator

@balzdur balzdur commented Jul 19, 2024

Finally did it, it was painfull but here we are !

In short: I updated to the last major of conformr (= the form lib I want to use in the app, that should replace entirely react-hook-form in the end).

NB: I tested all the forms to make sure no regressions are introduced + improved existing one (ex: when creating a scenario, error messages are displayed now).
Another UX improvment, when an error occure at first submit, each fields is validated "on change", so no more "dangling" error messages above fields (when the validation can be done frontend side, of course).

I honnestly doubt you can review it... reading some forms update should be a good way to catch the main changes :

  • FormProvider to access the state in order to give progressive enhancement
  • Globally the same interface we already used (for FormField, FormInput`....)
  • A better API to manipulate form data server side (possibility to return server errors directly on the form, huge improvement of the DX on this)
  • Totally new way to use custom components in forms

Copy link
Contributor

@Pascal-Delange Pascal-Delange left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my culture I think I'm still interested in an oral explanation of the changes to the components/Form files - otherwise LGTM

"@vitest/coverage-v8": "^1.6.0",
"@vitest/ui": "1.6.0",
"prettier": "^3.3.2",
"@vitest/coverage-v8": "^2.0.3",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to be sure and since those are major version changes, can you please double check the license type didn't change ?

"@conform-to/dom": "^0.9.1",
"@conform-to/react": "^0.9.1",
"@conform-to/zod": "^0.9.1",
"@conform-to/dom": "^1.1.5",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the comment is not at the good position

const name = useFieldName();
const [meta] = useField<boolean>(name);

const control = unstable_useControl(meta);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sanity check: what should I make of "unstable_" ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing 🤷🏽

This is a common convention for pkg mainteners to tell the public API is unstable and may be changed with breaking changes in the future; still the hook is introduced for more than 4 months now, w\ any changes. This was created in order to fix issues with the initial attempt of handling form custom inputs useInputControl.

More info here

@balzdur balzdur enabled auto-merge (squash) July 22, 2024 14:20
@balzdur balzdur merged commit 71ed3ec into main Jul 22, 2024
3 checks passed
@balzdur balzdur deleted the thomas/update-conform branch July 22, 2024 14:23
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

Successfully merging this pull request may close these issues.

2 participants