-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Nested field + reactive schema change doesn't validate #3284
Comments
Please create a working minimal reproduction of this, you can use codesandbox. |
Code sandbox doesnt even work. A default vue 3 app fresh from their homepage generates...
|
what a nightmare, luckily I could find their experimental node container version of vue3 which works... hopefully this is a real bug as this took hours to do 🥴 Step 1: go here There are 2 API calls that happen in the outer component. The first is to fetch the schema for the dynamic form. The 2nd API call is to populate the "user" object which has some static fields right on the user ( Step 2: notice that when the form loads, even though "Field Dos" has no key set in the user Step 3: To prove the "nested" portion of this, replace the 2nd API call with this one, where "name" is now commented out. Name is a 1st level field which is present at load time. You will notice now when the page loads the entire form loads as invalid (which is correct) |
Thank you, you could've set up a git repo with Vue-CLI as an alternative, sorry for not suggesting that. So looking at your demo, it does indeed look like a bug caused by the partial schema being filled. apparently, validation is skipped for non-touched fields because the schema has already been run before. It's not related to nested fields. This is of course not intended and I will tag a release for it shortly. |
Can you please verify if |
Nice!!! That fixed it. Super awesome. Thanks 🙏🏼 |
Versions
Describe the bug
It seems that reactive schemas work properly (passing a
computed()
) tovalidationSchema
)... and also nested objects work properly, likefields.subfield
), but it seems when both are combined the nested field isn't initially set to the proper valid. It does work however when typing into that nested input, but the initial value flag gets "stuck" at the initial schema. So an invalid field, which was valid for only a moment before the reactive schema updated, is incorrectly marked as valid.I have code examples in the discussion, but I'm pretty sure it's a bug at this point so I'm putting it here.
code is located in the last reply here: #3283
Expected behavior
I would expect the
valid
flag to change appropriately for nested fields, just like non-nested fields do (whether schema changes reactively or not)Here is the code again:
The text was updated successfully, but these errors were encountered: