tsparticles / react

React tsParticles official component
https://particles.js.org
MIT License
357 stars 24 forks source link

Particles started loading very slowly recently #96

Closed maxwowo closed 4 months ago

maxwowo commented 4 months ago

Hi there! Thanks for all the work you've put into this library. I've recently noticed that the particles, which would've taken no more than 500ms to load before, suddenly started taking very long to load on my website.

Screen record:

https://github.com/tsparticles/react/assets/40416283/9960b6c0-9d3f-4ea7-b01f-0ba267f3498c

Site: https://www.maxwowo.com/

Repo: https://github.com/maxwowo/maxwowo

File that mounts the particles: https://github.com/maxwowo/maxwowo/blob/master/src/components/particles.tsx

This is the case across Chrome, Firefox, and Safari. My site should be pretty simple in structure and I also haven't made any changes to it recently, so just wondering what might be going on

Cheers

matteobruni commented 4 months ago

You need to move the initParticlesEngine in another place, that loads all the script necessary to start the animation and it could take a while since now uses dynamic imports to reduce the bundle size. You can call it in the index, or some place where you are loading other stuff as well. The readme itself uses it in the main App function.

maxwowo commented 4 months ago

I see, cheers for the explanation!