I want to update validation on one field depending on the state of the other. The situation I've got is as follows:
- Fill the email field properly (no errors shown)
- Fill the phone number field properly (no errors shown)
- Delete phone number (no errors shown because email is still valid and phone number is dependent on it).
- Delete email - now here is a weird behaviour - email field shows proper error but phone number shows old error ('invalid phone number') but it should show new error, same as email does ('we need at least one form of contact').
When I focus on the phone number field and then unfocus it 'updates' and shows proper error.
What I want to do is show proper phone number error on step 4. Without the need to focus/unfocus.
I hope that codesandbox will make things clearer: https://codesandbox.io/s/hopeful-nightingale-0m41z