Skip to content

Commit

Permalink
use getRawState for all
Browse files Browse the repository at this point in the history
  • Loading branch information
atmonshi committed Jun 29, 2024
1 parent e6bdbd3 commit 568f914
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Resources/Pages/CreateRecord/Concerns/Translatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ public function updatedActiveLocale(string $newActiveLocale): void

$translatableAttributes = static::getResource()::getTranslatableAttributes();

$this->otherLocaleData[$this->oldActiveLocale] = Arr::only($this->form->getState(), $translatableAttributes);
$this->otherLocaleData[$this->oldActiveLocale] = Arr::only($this->form->getRawState(), $translatableAttributes);

try {
$this->form->fill([
...Arr::except($this->form->getState(false), $translatableAttributes),
...Arr::except($this->form->getRawState(), $translatableAttributes),
...$this->otherLocaleData[$this->activeLocale] ?? [],
]);

Expand Down
6 changes: 3 additions & 3 deletions src/Resources/Pages/EditRecord/Concerns/Translatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected function handleRecordUpdate(Model $record, array $data): Model
->all();

try {
$this->form->fill($this->form->getState(false));
$this->form->fill($this->form->getRawState());
$this->form->validate();
} catch (ValidationException $exception) {
if (! array_key_exists($locale, $existingLocales)) {
Expand Down Expand Up @@ -82,14 +82,14 @@ public function updatedActiveLocale(): void
$translatableAttributes = static::getResource()::getTranslatableAttributes();

$this->otherLocaleData[$this->oldActiveLocale] = Arr::only(
$this->form->getState(false),
$this->form->getRawState(),
$translatableAttributes
);

try {
$this->form->fill([
...Arr::except(
$this->form->getState(false),
$this->form->getRawState(),
$translatableAttributes
),
...$this->otherLocaleData[$this->activeLocale] ?? [],
Expand Down

0 comments on commit 568f914

Please sign in to comment.