Skip to content

Commit

Permalink
prevent local switcher if there is a validation error
Browse files Browse the repository at this point in the history
  • Loading branch information
atmonshi committed Jun 13, 2024
1 parent 08a5748 commit 9c26924
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Resources/Pages/EditRecord/Concerns/Translatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ public function updatedActiveLocale(): void

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

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

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

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

0 comments on commit 9c26924

Please sign in to comment.