title: Returning true in Yup test function is not clearing the previous error message in react-hook-form formState
body: <p>Repo to duplicate the problem: <a href="https://codesandbox.io/s/yup-react-hook-form-material-checkbox-5dqbm" rel="nofollow noreferrer">https://codesandbox.io/s/yup-react-hook-form-material-checkbox-5dqbm</a></p>
  <p>I am working on a form that I created with react-hook-form and yup. I have a  checkbox group and I am trying to require at least one checkbox to be selected before submitting. I created a checkbox group with Material UI and handled validation with yup test function.</p>
  <p>Here are my default values showing the structure.</p>
  <pre><code> const defaultValues = {
      companyName: &quot;&quot;,
      singleCheckbox: false,
      multiCheckbox: { option1: false, option2: false }
    };
  </code></pre>
  <p>And this is my yup validation. Basically, I am checking if one of the options of multiCheckbox is true, return true otherwise return false.</p>
  <pre><code> const yupSchema = yup.object().shape({
      companyName: yup.string().required(&quot;Company name is required&quot;),
      singleCheckbox: yup.boolean().test(&quot;singleCheckbox&quot;, &quot;Required&quot;, (val) =&gt; {
        console.log(val, &quot;yup singleCheckbox result&quot;);
        return val;
      }),
      multiCheckbox: yup
        .object()
        .shape({
          option1: yup.boolean(),
          option2: yup.boolean()
        })
        .test(
          &quot;multiCheckbox&quot;,
          &quot;At least one of the checkbox is required&quot;,
          (options) =&gt; {
            console.log(
              options.option1 || options.option2,
              &quot;yup multiCheckbox result&quot;
            );
            return options.option1 || options.option2;
          }
        )
    });
  </code></pre>
  <p>Problem: When I hit 'Submit' button without filling out any field, I see all the error messages that I should. And error messages are disappearing when I start filling the input form and clicking on the single checkbox but error message for multiCheckbox is not going away.</p>
  <p>First I thought something is wrong with the test function, that's why I implemented the same logic to singleCheckbox as well. singleCheckbox is working as expected but multiCheckbox is not,  even though test function of yup returns true.</p>
  <p>What I have tried: I tried to change revalidation value of useForm to onBlur and onChange but it didn't work out for me.</p>
  <p>Observation: Clicking on Submit button brings all the error messages. After selecting one of the options of multiCheckbox and hitting submit button again clears error message of  multiCheckbox. So I am assuming there is a disconnection between yup validation and react-hook-form validation. But why same disconnection is not happening for single singleCheckbox?</p>