inertia-laravel
inertia-laravel copied to clipboard
Update versioning in middleware
The first check that's done in the default version method of the middleware is to check if app.asset_url exists. This was added to support Laravel Vapor, see the comment in the original commit by @claudiodekker: https://github.com/inertiajs/inertia-laravel/commit/b1a4af2094bee755a154ed233f48b3fe825b1e39
This can however introduce unintended behaviour. For example if you have your assets located on a CDN it would just be a static URL. This causes the version hash to not update, so deploying a new version of your app would cause issues as clients would try to fetch non-existing assets and Inertia not forcing a refresh on the client.
A simple fix is instead of just checking if the config value exists we'd check if the app is running within Vapor (see https://github.com/laravel/vapor-core/pull/164)
+1
Happened to me. Version was never changing due to ASSET_URL being set, so navigation would break each time I would build. Wreaked havoc!
Makes sense, thanks.