motion icon indicating copy to clipboard operation
motion copied to clipboard

[BUG] Issue with a router redirection via react-router-dom

Open eugenebuhor opened this issue 6 years ago • 2 comments

Describe the bug AnimatePresence component doesn't update it's children after navigation through Redirect component or any other way of redirection , e.g. history.replace(). It causes a problem that the children is not displayed after the redirection. At the attached video you can see that after the redirection Switch component still has an old key, which is basically location.pathname.

You can also play with it on a sample demo project - https://codesandbox.io/s/framer-motion-with-react-router-redirect-issue-2q9b1.

Steps to reproduce Click on redirect to / link in the bottom.

Expected behavior Children component is updated.

Video or screenshots Screen Recording 2020-07-22 at 20 30 14

eugenebuhor avatar Jul 22 '20 17:07 eugenebuhor

The issue is reproducible with framer-motion v1 as well as with v2. Also here are some related issues - https://github.com/framer/motion/issues/606, https://github.com/framer/motion/issues/466.

eugenebuhor avatar Jul 23 '20 12:07 eugenebuhor

Dupe https://github.com/framer/motion/issues/466

mattgperry avatar Oct 28 '21 09:10 mattgperry