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

Form replicate does not copy over validators #6

Open
lakardion opened this issue Dec 1, 2022 · 1 comment
Open

Form replicate does not copy over validators #6

lakardion opened this issue Dec 1, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@lakardion
Copy link
Member

Repro steps

  • Create a form
  • Add a validator to one of the fields with addFormLevelValidator
  • replicate the form
  • Check replicated form: added validator was lost

Expected

A replicated form should keep validators even if they were not part of the class Form definition

@lakardion lakardion added the bug Something isn't working label Dec 1, 2022
@lakardion lakardion self-assigned this Dec 1, 2022
@paribaker
Copy link
Collaborator

This is interesting, there are two ways to add dynamic form level validators, one is defining it statically static dynamicValidators on the model when building the form and the other is dynamically adding it after the form is initialized with the addValidatorMethod because of the way reactivity is handled in React the static method does not keep track of the comparing field so addFormLevelValidator is the preferred method. Since this method does not affect the underlying class it correctly does not get copied over.
Will need to consider what would happen should we try and copy over all the validators that are added to an instance themselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants