You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is something I noticed, and it seems to be a bug in the "default" handling. Sometimes the pre-filled value is not actually getting saved with the response even though it shows up correctly in the application form.
So we end up with something like this, where the Name and Address fields are blank, even though the selected manufacturer clearly has them:
What's weird is that the form passes validation, even though those fields are required. So the local state must think they have values, and they're just not getting saved to the database reliably.
Unfortunately this is inconsistent, and I can't yet figure out how how to reliably reproduce it.
The text was updated successfully, but these errors were encountered:
Okay, so the problem is that when the "Select manufacturer" question is initially sending a null default to the name field. And when it changes, the Name element re-renders, initially with a null default before quickly updating again with the new selected name as the default. And because null is a valid value, both the "null" and actual name get written to the database. And because they're async, sometimes the null one actually finishes last even though it was started first, so you end up with null in the database even though the front-end state has the correct new value.
In this case, we can prevent the problem by adding the preventNullDefault parameter to the text inputs (and a couple of other safeguards), but it would be good if we could make this a bit more robust.
The problem is, the "name" field initially starts of hidden, so it is not rendered at all, so when it becomes visible it gets the original "null" default and the proper default almost simultaneously, hence the race condition.
Maybe using the "preventNullDefault" is enough? Or maybe we should set preventNullDefault to be true by default? Need to see which cases are more common, and which has the worst consequences if it's set incorrectly for the situation.
This is something I noticed, and it seems to be a bug in the "default" handling. Sometimes the pre-filled value is not actually getting saved with the response even though it shows up correctly in the application form.
So we end up with something like this, where the Name and Address fields are blank, even though the selected manufacturer clearly has them:
What's weird is that the form passes validation, even though those fields are required. So the local state must think they have values, and they're just not getting saved to the database reliably.
Unfortunately this is inconsistent, and I can't yet figure out how how to reliably reproduce it.
The text was updated successfully, but these errors were encountered: