Skip to content

Commit

Permalink
Fix: reset upload new form field on save
Browse files Browse the repository at this point in the history
  • Loading branch information
awcodes committed Jan 10, 2024
1 parent a903df3 commit 700bfc2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Resources/MediaResource/EditMedia.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,16 @@ public function getHeaderActions(): array
DeleteAction::make(),
];
}

protected function afterSave(): void
{
$state = $this->getForm('form')->getRawState();

if ($state['file'] !== null) {
$livewire = $this->getForm('form')->getLivewire();
$statePath = $this->getForm('form')->getStatePath();

data_set($livewire, $statePath . '.file', null);
}
}
}

0 comments on commit 700bfc2

Please sign in to comment.