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

root instance does not capture nested instances validations results if they have $rewardEarly: true and root does not. #1229

Open
renatodeleao opened this issue Feb 28, 2024 · 0 comments

Comments

@renatodeleao
Copy link

renatodeleao commented Feb 28, 2024

Describe the bug

When building complex forms with nested useVuelidate instances, it is expected that, without specific configs like $scope or $stopPropagation, the root instance automatically captured nested instances validations (by running nested form instances validators).

This assumption is broken if the root instance does not have $rewardEarly config and one of the child instances have.

Do note that if both parent and child have $rewardEarly: true the validations are captured as expected.

Reproduction URL

Vuelidate 2 - Composition API + Vue 3

To Reproduce
Steps to reproduce the behavior:

  1. Go to the demo, click submit without touching the form
  2. Notice that with the default configuration (both $rewardEarly: true) the validations from both root and nested forms are triggered
  3. Now remove $rewardEarly: true configuration from the RootForm
  4. Refresh the demo and click submit
  5. Notice that only RootForm validators are triggered.

Expected behavior

Since neither $scope or $stopPropagation are use, it is expected that root form to capture validation results from child, independently of it has $rewardEarly: true or not as parent as nested form might be a reusable partial and parent shouldn't have any knowledge about it's validation mode configuration.

Additional context

We can workaround by manually calling v$.value.$commit() on the RootForm to ensure that validations are captured. But this should be automatic.

@renatodeleao renatodeleao changed the title root instance does not capture nested instances validation results if they have $rewardEarly: true root instance does not capture nested instances validations results if they have $rewardEarly: true Feb 28, 2024
@renatodeleao renatodeleao changed the title root instance does not capture nested instances validations results if they have $rewardEarly: true root instance does not capture nested instances validations results if they have $rewardEarly: true and root does not. Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant