Our formstate Fetched Data currently tracks keys of fetched items as a hash tag of unique keys of nid,childId, etc fields.This has a limitation as repeaters allows each repeater item use the same key for retrieved data.What I have implemented:
Fetched data that check validation currently check both their key and thier parent key (the index key of the repeated item).
For fields in repeaters, their fetched data is saved under their repeater key, in an array of repeated items.
{
formState: {
...
FETCHED_DATA: {
NID_8SJS: {
..// fetched data for normal NID
},
REPEATER_FIELD_IS393: [
{
NID_REPEATER_CHILD_838383: {
.. // fetched data for nid in repeater at index 0
},
ANOTHER_FETCH_FIELD_KEY_0: ....
},
....
....
{
NID_REPEATER_CHILD_838383: {
.. // fetched data for nid in repeater at index n
},
ANOTHER_FETCH_FIELD_KEY_n: ....
},
....
],
}
}
}
So for normal fetch fields, we previously had ..
formState?.FETCHED_DATA?.NID_8SJS?.firstName
but if it's in a repeater, we would have:
formState?.FETCHED_DATA?.REPEATER_FIELD_IS393?.***{{ index of item in repeater }}***?.NID_8SJS?.sex
example:
formState?.FETCHED_DATA?.REPEATER_FIELD_IS393?.***[ +field?.parent?.key ]***.NID_8SJS?.sex
or
formState?.FETCHED_DATA?.REPEATER_FIELD_IS393?.***0***.NID_8SJS?.sex
SEE: USE GENERIC/ASUNC UTIL VALIDATORS IN REPEATERS below on how to use this in repeaters for async/generic valdiators