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

Is there some way of knowing when Default values from schema are loaded? #4232

Open
1 task done
brada11en opened this issue Jun 30, 2024 · 1 comment
Open
1 task done

Comments

@brada11en
Copy link

Prerequisites

What theme are you using?

antd

What is your question?

onChange event gets fired but there is no differentiation that i can see between a user updating the form and default values being loaded.
wanting to save the initial formData to compare against when the user changes the form data
thanks for your help ;)

@brada11en brada11en added needs triage Initial label given, to be assigned correct labels and assigned question labels Jun 30, 2024
@heath-freenome
Copy link
Member

@brada11en You are right there is not easily discernable way to know whether an onChange was the result of a user entering the data and the default logic kicking in an specifying defaults. Upon the first render with empty form data and defaults in the schema, one would get an onChange that was the result of the defaults being added. But if one is using conditions to expand chunks of the schema based on a user's answer, then it is likely that there will be 2 onChange() calls, one for the user's data change and a second to notify of the additional default values added. In that situation, the first onChange() will get an id for the field the user changes and the second onChange() will NOT get an id. So it may be possible for you to trigger off of whether onChange() gets the optional id passed to it to detect human interactions vs. defaults.

@heath-freenome heath-freenome added awaiting response and removed needs triage Initial label given, to be assigned correct labels and assigned labels Jul 5, 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

2 participants