table action modal form refresh?

Since I've been unable to get the FileUpload component to display a preview when a file is present on the model, I decided to make a custom "FileAttachment" field, that shows the attachment and has a button to click to remove the attachment. I'm using this inside of a table row action and it's working as expected except the form isn't updated when the wire:click event is completed.
EditAction::make('editTransaction')
...
->form([
FileUpload::make('document')
->label('Attach Document')
->preserveFilenames()
->acceptedFileTypes(['application/pdf', 'application/jpeg'])
->maxSize(12288)
->live()
->visible(fn (Model $record) => empty($record->document_id))
->storeFiles(false),
FileAttachment::make('attachment')
->description(fn (Get $get) => $get('file_name') ?? null)
->live()
->id(fn (Model $record) => $record->document_id)
->visible(fn (Model $record) => !empty($record->document_id))

])
EditAction::make('editTransaction')
...
->form([
FileUpload::make('document')
->label('Attach Document')
->preserveFilenames()
->acceptedFileTypes(['application/pdf', 'application/jpeg'])
->maxSize(12288)
->live()
->visible(fn (Model $record) => empty($record->document_id))
->storeFiles(false),
FileAttachment::make('attachment')
->description(fn (Get $get) => $get('file_name') ?? null)
->live()
->id(fn (Model $record) => $record->document_id)
->visible(fn (Model $record) => !empty($record->document_id))

])
//called from wire:click on my custom field blade file.
public function removeAttachment($id)
{

//do delete stuff
$this->form->fill() //not working, which I kind of expect given the context of a table row action, but not sure what else to try.
//called from wire:click on my custom field blade file.
public function removeAttachment($id)
{

//do delete stuff
$this->form->fill() //not working, which I kind of expect given the context of a table row action, but not sure what else to try.
1 Reply
Jon Mason
Jon MasonOP8mo ago
I've also tried to add this to the EditAction:
->after(function () {
$this->form->fill();
})
->after(function () {
$this->form->fill();
})
and...
->after(function () {
$this->table->reset();
})
->after(function () {
$this->table->reset();
})
Want results from more Discord servers?
Add your server