laravel / octane

Supercharge your Laravel application's performance.
https://laravel.com/docs/octane
MIT License
3.71k stars 284 forks source link

Give New Application to Routes #899

Closed dbpolito closed 1 month ago

dbpolito commented 1 month ago

Routes instances are still referencing the old container...

I was hitting this error in a filament / livewire app, more specifically here: https://github.com/livewire/livewire/blob/main/src/Mechanisms/PersistentMiddleware/PersistentMiddleware.php#L149

Using cached routes does not hit this problem, that's why i'm only doing to uncached routes.

taylorotwell commented 1 month ago

What actually goes wrong?

dbpolito commented 1 month ago

It's a very specific error, if a have a Controller with some injection on __construct, it throws this error:

Target [xxxContract] is not instantiable while building [xxxController, xxxRepository].

As the route is already loaded but referencing the old container, it's trying to inject using the wrong container, which probably got cleared.

The error happens on the livewire action, at the livewire.update ajax.