79707858

Date: 2025-07-20 08:35:02
Score: 1.5
Natty:
Report link

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

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • User mentioned (1): @script
  • User mentioned (0): @endscript
  • Low reputation (1):
Posted by: reem