Skip to content

Instantly share code, notes, and snippets.

@runzway
Created March 3, 2025 13:17
Show Gist options
  • Save runzway/423b92a8b28550aac50b3f664a523514 to your computer and use it in GitHub Desktop.
Save runzway/423b92a8b28550aac50b3f664a523514 to your computer and use it in GitHub Desktop.
Bug fix: Livewire fast navigation
/**
* Rezolva bugul de navigare
* 'Too many calls to location or history APIs in a short period of time.'
* Exista un PR pentru Livewire care rezolva asta dar inca nu este merged
* Probabil ca pe viitor vom scoate codul asta
*
*/
const original = window.history.replaceState;
let previousState = null
window.history.replaceState = function (state, unused, url) {
state.url = url instanceof URL ? url.toString() : url
if (JSON.stringify(state) === JSON.stringify(previousState)) {
return
}
original.apply(this, [state, unused, url])
previousState = state
};
@runzway
Copy link
Author

runzway commented Mar 3, 2025

In PanelProvider, boot() method

use Filament\Support\Facades\FilamentAsset;
use Filament\Support\Assets\Js;

FilamentAsset::register([
  Js::make('livewire-fix', __DIR__ . '/../../../resources/js/livewire-bug-fix.js'),
]);

then

php artisan filament:assets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment