I have run through that solution seeking too, and what i could afford to do was with private storage that on the modal you store values on the private storage, and get them back on the build form of the 1st form, by the key that you signed previously on the private storage. (Drupal 10.x)
Geting the same problem on 10.x version
hey, i have the same type of situation over here, where i have a item modal form, and want to populate a table with various items on the main form
$response->addCommand(new InvokeCommand(NULL, 'MainForm::updateItemTable', [$item_data]));
the further i went was trying with this, but the function updateItemTable on the main form doesnt get triggered :X
appreciate further help/enlightment