I faced the same problem so as one of the answer mentioned adding @script fixed the problem but not completely you need to call the function without adding any event listener
At the end of script call the fuction alone:
initAnimatedStats();
don't do this:
document.addEventListener('DOMContentLoaded', function () {
initAnimatedStats();
});
or this:
document.addEventListener('livewire:navigated', function () {
Livewire.hook('message.processed', (message, component) => {
initAnimatedStats();
});
});
and i faced a problem when adding @endscript so when i removed it every thing fixed :) to let you know i'm using flux too so i'm not sure about the cause of problem
You can see this for more information
https://livewire.laravel.com/docs/javascript