Updating a Relation Manager Form Without Closing

Hey all - I am upgrading my Livewire version to 3.5 from 3.3 and I've run into a problem. I need to update a relation manager form without closing it and reopening it. In the old version, I use the following:
// form schema for edit order in relation manager
// other form info
Actions::make([
Action::make('submitThisMeal')
->label('Submit')
->action(function () {
// handle submission and create selection
})
->after(function ($livewire) {
$livewire->dispatch('refreshModal');
})

// OrdersRelationManager
#[On('refreshModal')]
public function refresh(): void
{
// unset the form
unset($this->cachedForms['mountedTableActionForm']);
// reload the form
$this->cacheForm('mountedTableActionForm', null);

// application logic to find new selection...
// set form with new data
$this->mountedTableActionsData[0]['existingSelectionInfo'][$selection->meal->menuCategory->name][$selectionIndex]['mealId'] = $selection->meal_id;
}
}
// form schema for edit order in relation manager
// other form info
Actions::make([
Action::make('submitThisMeal')
->label('Submit')
->action(function () {
// handle submission and create selection
})
->after(function ($livewire) {
$livewire->dispatch('refreshModal');
})

// OrdersRelationManager
#[On('refreshModal')]
public function refresh(): void
{
// unset the form
unset($this->cachedForms['mountedTableActionForm']);
// reload the form
$this->cacheForm('mountedTableActionForm', null);

// application logic to find new selection...
// set form with new data
$this->mountedTableActionsData[0]['existingSelectionInfo'][$selection->meal->menuCategory->name][$selectionIndex]['mealId'] = $selection->meal_id;
}
}
Basically, this is all happening on the EditEvent page. Each event can have many Orders. Each Order has many Selections. I want users to be able to make selections and view the menu they have picked in real time in the modal that appears (updating after each selection). The selections appear at the top of the form and the section to make a new selection is at the bottom. This works in 3.3 but not above. Does anyone know why? In general, can anyone suggest a better way to present what I am talking about? I don't like my current solution but it works. Thanks in advance
0 Replies
No replies yetBe the first to reply to this messageJoin