Skip to content

Commit

Permalink
Merge pull request #15514 from borjajimnz/fix/refresh_form_data_issue…
Browse files Browse the repository at this point in the history
…_14222

Fix refreshFormData to update the data correctly using form->fill
  • Loading branch information
danharrin authored Feb 6, 2025
2 parents 9500083 + c657f7c commit 229437c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/panels/src/Resources/Pages/EditRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,12 @@ protected function fillFormWithDataAndCallHooks(Model $record, array $extraData
*/
public function refreshFormData(array $attributes): void
{
$this->data = [
$data = [
...$this->data,
...Arr::only($this->getRecord()->attributesToArray(), $attributes),
];

$this->form->fill($data);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion packages/panels/src/Resources/Pages/ViewRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,12 @@ protected function fillFormWithDataAndCallHooks(Model $record, array $extraData
*/
public function refreshFormData(array $attributes): void
{
$this->data = [
$data = [
...$this->data,
...Arr::only($this->getRecord()->attributesToArray(), $attributes),
];

$this->form->fill($data);
}

/**
Expand Down

0 comments on commit 229437c

Please sign in to comment.