Syncing data across group fields
I have a multi step form using group fields. The first group is just a upload file field to grab a PDF. The next group I extract it with pdf-parse using react-query as if it's async data, and display what it extracted. Third group/step I sync the extracted values to these group fields so it has initial data and I can also update the fields in case the extraction was incorrect somewhere.
My understanding is I can't use async initial values because all the groups are created at once, so the initial data would be null since I haven't uploaded a file yet.
I tried getting rid of the query and only using a field onchange listener, adding dynamic on change, but I couldn't get the errors to be in the field properly so the form continued to be valid and allowed to move forward even if the PDF extraction failed.
I ended up going back to what I had, leaving my custom useEffect to sync my data to fields. Am I missing something? Was I close? Or is the useEffect necessary here?
My understanding is I can't use async initial values because all the groups are created at once, so the initial data would be null since I haven't uploaded a file yet.
I tried getting rid of the query and only using a field onchange listener, adding dynamic on change, but I couldn't get the errors to be in the field properly so the form continued to be valid and allowed to move forward even if the PDF extraction failed.
I ended up going back to what I had, leaving my custom useEffect to sync my data to fields. Am I missing something? Was I close? Or is the useEffect necessary here?