inertia-laravel
inertia-laravel copied to clipboard
Multiple invocations of AppServiceProvider boot() method on Inertia Render
Is there a way to prevent Inertia::render from call AppServiceProvider boot() method multiple times in a request?
When invoking from a simple controller method , adding traces to AppServiceProvider boot() shows the method called 2x during the request.
Route::get('/welcome',function() {
return Inertia::render('Welcome');
}
If you modify the route, with the following , you will only see one invocation of the boot() method.
Route::get('/welcome',function() {
return response()->json(['status' => 'success']);
}
Multiple invocations of the boot method may not be a huge deal except in a modules environment where all the modules boot methods are invoked multiple times.
Sounds like something else is happening in your app as Inertia does not call the boot
method of your service providers. Are you sure these calls happen in the same request?
In the past I've had similar issues like this and it turned out to be a combination of a catch-all route and a missing favicon.
Roj -
Missing favicon was the culprit.
Thanks!
Ron
On Fri, May 6, 2022 at 8:08 AM Roj Vroemen @.***> wrote:
Sounds like something else is happening in your app as Inertia does not call the boot method of your service providers. Are you sure these calls happen in the same request?
In the past I've had similar issues like this and it turned out to be a combination of a catch-all route and a missing favicon.
— Reply to this email directly, view it on GitHub https://github.com/inertiajs/inertia-laravel/issues/393#issuecomment-1119722434, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACKOT5JIATUPTWOIIT22XP3VIUYWBANCNFSM5VC7O5CA . You are receiving this because you authored the thread.Message ID: @.***>
@reinink looks like this has been resolved and can be closed 👍