auto-animate icon indicating copy to clipboard operation
auto-animate copied to clipboard

Animations work on dev but not on hosted app

Open gohyun14 opened this issue 1 year ago • 2 comments

I just created a test application using AutoAnimate, and while testing on my local environment all the animations work as desired, however after deploying the app none of the animations work at all. I am using React and NextJS and hosting on Vercel. Does anyone know why this would be and what I could try to fix it?

gohyun14 avatar Oct 01 '22 01:10 gohyun14

I'm not having this issue, but similar, maybe.

Animations just worked on dev last week, and now they don't work on dev or preview deployment

specifically, useAutoAnimate is not working.

Manually doing

const animate = useRef(null);
useEffect(()=> (animate.current && autoAnimate(animate.current)))

works

I would have assumed that was most of what useAutoAnimate did anyway?

looks like useAutoAnimate uses an empty dep array on the useEffect so if the element in question isn't there at the start (conditionally rendered), it'll not hook up (this was my issue)

ekwoka avatar Oct 11 '22 12:10 ekwoka

We havent changed anything in that time frame.

Keep in mind animations are disabled when prefers-reduced-motion is on.

justin-schroeder avatar Oct 11 '22 13:10 justin-schroeder

I may have had a similar issue in Chrome 106 yesterday. Animations just suddenly stopped working. Been looking into what was wrong and reverted everything back to a working version to find that animations were just not working anymore. Then I tried a different browser and it worked. Must have been chrome, incorrectly passing on prefers-reduced-motion at some point because after a restart it worked again.

verheyenkoen avatar Oct 26 '22 13:10 verheyenkoen