F
Filament4mo ago
Harvey

Spatie/translatable cannot mutate prop $activeLocale in relation manager

I followed the docs, on how to make a relation manager inherit the current resource's locale. But now when the RM loads it throws an error. I added the following to my relation manager:
use Translatable;

#[Reactive]
public ?string $activeLocale = null;
use Translatable;

#[Reactive]
public ?string $activeLocale = null;
and that's it... the rest of the relation manager is just a table with 1 column in it. EDIT: Looks like the mountTranslatable() from the trait is booting before $activeLocale has a value, and it then tries to set to 'en', but Livewire does not like child components updating a property with the #[Reactive] trait. Any thoughts? Or is this just a bug?
No description
1 Reply
Harvey
HarveyOP4mo ago
Update: Can bodge it by adding
public function __construct()
{
$this->activeLocale = config('app.locale');
}
public function __construct()
{
$this->activeLocale = config('app.locale');
}
to the relation manager
Want results from more Discord servers?
Add your server