Skip to content

Use RHF validation mode onTouched instead of all - #1770

Merged
david-crespo merged 1 commit into
mainfrom
rhf-validation-mode
Oct 4, 2023
Merged

david-crespo merged 1 commit into
mainfrom
rhf-validation-mode

Conversation

@david-crespo

@david-crespo david-crespo commented Oct 4, 2023 •

Copy link
Copy Markdown
Collaborator

Closes #1761

Does not do #1289 because it still validates on that first blur even if you didn't type anything.

onTouched validates first on blur, and after that on change. I think I like that, but I'm flexible. onBlur is almost the same except it always validates on blur instead of change. The annoying thing to me about blur only is that if you go into a field with a validation error and correct it, the error won't go away until you blur. I find that a little surprising.

On the implementation side I considered just replacing mode: 'all' with mode: 'onTouched' in all the call sites, and could definitely change it to that, but it feels slightly less error-prone to me to use the shared wrapper, and then you don't have the noise of the mode at every call site.

Full table of mode options from the RFD docs image
2023-10-04-rhf-onTouched.mp4

@vercel

vercel Bot commented Oct 4, 2023 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
console ✅ Ready (Inspect) Visit Preview Oct 4, 2023 8:15pm

@david-crespo
david-crespo merged commit 0cc1e03 into main Oct 4, 2023
@david-crespo
david-crespo deleted the rhf-validation-mode branch October 4, 2023 20:28
david-crespo added a commit to oxidecomputer/omicron that referenced this pull request Oct 4, 2023
oxidecomputer/console@af6536d...0cc1e03

* [0cc1e03a](oxidecomputer/console@0cc1e03a) oxidecomputer/console#1770
* [48aea2f4](oxidecomputer/console@48aea2f4) npm audit fix
* [84aff1de](oxidecomputer/console@84aff1de) oxidecomputer/console#1769
* [c127febd](oxidecomputer/console@c127febd) oxidecomputer/console#1768
* [8c9513c1](oxidecomputer/console@8c9513c1) oxidecomputer/console#1765
* [0314fd72](oxidecomputer/console@0314fd72) oxidecomputer/console#1742
* [8918ffa9](oxidecomputer/console@8918ffa9) skip the other flaky test in safari for now. I'm suffering
* [b357246e](oxidecomputer/console@b357246e) increase playwright total time to 20 minutes
* [4f7d401](oxidecomputer/console@4f7d401d) be sneakier about PR numbers in commit messages in bump omicron PR
david-crespo added a commit to oxidecomputer/omicron that referenced this pull request Oct 4, 2023
The only functional change should be the form validation one. And one
icon. But there are some tweaks to our build setup that I'd like to make
sure we didn't mess up.

oxidecomputer/console@af6536d...0cc1e03

* [0cc1e03a](oxidecomputer/console@0cc1e03a)
oxidecomputer/console#1770
* [48aea2f4](oxidecomputer/console@48aea2f4)
npm audit fix
* [84aff1de](oxidecomputer/console@84aff1de)
oxidecomputer/console#1769
* [c127febd](oxidecomputer/console@c127febd)
oxidecomputer/console#1768
* [8c9513c1](oxidecomputer/console@8c9513c1)
oxidecomputer/console#1765
* [0314fd72](oxidecomputer/console@0314fd72)
oxidecomputer/console#1742
* [8918ffa9](oxidecomputer/console@8918ffa9)
skip the other flaky test in safari for now. I'm suffering
* [b357246e](oxidecomputer/console@b357246e)
increase playwright total time to 20 minutes
* [4f7d401](oxidecomputer/console@4f7d401d)
be sneakier about PR numbers in commit messages in bump omicron PR

This branch was successfully deployed

1 active deployment
Preview — 5621ba3e Deployed Oct 4, 2023 by vercel[bot]
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.

Don't use RHF validation mode: 'all'

1 participant