FilamentF
Filament15mo ago
Hugo

Modal Footer Action closes modal ,opens another modal then reset arguments

Hello. I am trying to have an action create a temporary record and then open another modal to fill extra data.
So far I've made it work like so

->action(function ($data, $arguments,$livewire, $action) {
                    if($arguments['withoutSizes'] ?? false){
                        $record = CreateArticleTypeAction::fromArray($data);
                      $livewire->replaceMountedTableAction('create_sizes', (string)$record->id, ['without_sizes' => true]);
                    }
                })

This second modal that is an row action on my table, will change it's form depending on the $arguments (whether is comes from a previous modal or if the users click on the row action).
My problem now is that after submitting the second action modal form, I would like to reset the arguments of the action (so that if the user clicks on the row action, the form is the default one). These arguments were set above:
$livewire->replaceMountedTableAction('create_sizes', (string)$record->id, ['without_sizes' => true]);


on the second action, on the ->action method, i've tried to $action->resetArguments(); or even $livewire->getMountedTableAction()->resetArguments(); and after dumping the arguments they appear to have been reseted but when I press on the row action, the form still has the same format as if it still has $arguments. This behavior only changes after refreshing the page, but I would like to avoid it and have it dynamically change.

I've thought about other solutions like creating an hidden action with that specific form but I would like to know if there is a way to do what i am trying to.
Was this page helpful?