Redirect from Livewire component boot()

I have a Livewire component with a form and in the boot() method I conditionally redirect to the dashboard. Unfortunately that redirect() does not work (it's executed, but does not redirect) and the getFormSchema() gets executed, while it shouldn't. Can somebody point what I'm doing wrong? Here's a sample code:
namespace App\Http\Livewire;
class XXX extends Component implements HasForms
{
public function boot()
{
return redirect()->route('filament.pages.dashboard');
}

protected function getFormSchema(): array
{
// this gets executed
}
}
namespace App\Http\Livewire;
class XXX extends Component implements HasForms
{
public function boot()
{
return redirect()->route('filament.pages.dashboard');
}

protected function getFormSchema(): array
{
// this gets executed
}
}
1 Reply
awcodes
awcodes7mo ago
Try it in mount() instead of boot(). Boot might be too early for the redirect.
Want results from more Discord servers?
Add your server