question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] SVG briefly appearing on render when it shouldn't based on motion value and variant

See original GitHub issue

1. Read the FAQs 👇2. Describe the bug

Hi 👋 I just upgraded from Motion 1.x to 2.x on one of my repo and noticed that one of my SVGs which can be in 2 different state checked (shows the sun icon) or uncheck (shows the moon icon) sometimes renders both state overlapping for 1 or 2 frames before going to the expected state. It does not happen consistently, only some times, and I really need to repeat several refreshes in order to reproduce the issue

It only happens upon re-rendering the website. I first thought it was due to some race condition on my end, but no, I can reproduce the issue very easily. See CodeSandbox below for a minimal reproduction.

Maybe I’m doing something wrong as well, and I’m misusing useMotionValue and useTransform but from what I;m seeing, these are still set properly.

3. IMPORTANT: Provide a CodeSandbox reproduction of the bug

See the following code sandbox for a minimal reproduction: https://codesandbox.io/s/frosty-dream-jkkmd?file=/src/App.js

4. Steps to reproduce

Steps to reproduce the behavior:

  1. Go to the codesandbox above
  2. Refresh the codesandbox browser several times
  3. See the moon SVG briefly appearing (it shouldn’t as the condition isChecked is set to false in the code)

5. Expected behavior

I’d expect to consistently get 1 of the 2 SVGs to render based on the value of isChecked

6. Video or screenshots

Kapture 2020-11-21 at 13 17 38

You can see in the recording that the moon icon is briefly appearing for like 1 or 2 frames before disappearing expected state

7. Environment details

macOS Big Sur Chrome/Firefox framer-motion: 2.6.13 react 16.13.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9

github_iconTop GitHub Comments

2reactions
tomdohnalcommented, Dec 8, 2020

I only found this pull request https://github.com/framer/motion/pull/857

1reaction
mattgperrycommented, Jun 2, 2022

Can’t reproduce in 6

Read more comments on GitHub >

github_iconTop Results From Across the Web

Here's How I Solved a Weird Bug Using Tried and True ...
At first, this looks like a CSS issue. Some styles might be applied on a hover event that breaks the layout or the...
Read more >
Motion values overview | Framer for Developers
Motion values track the state and velocity of animating values. ... Update visual properties without triggering React's render cycle. Subscribe to updates.
Read more >
Add multi-density vector graphics - Android Developers
The image appears in the Vector Drawable Preview. If the SVG or PSD file contains unsupported features, an error appears at the bottom...
Read more >
Safari Technology Preview Release Notes - Apple Developer
Note: Shared Tab Groups and syncing for Tab Groups, Website Settings, and Web Extensions are not enabled in this release. WebAssembly. Fixed error...
Read more >
How to Add Interactive Animations and Page Transitions to a ...
But just because those apps are static, it doesn't mean they have to be boring. How can we use Framer Motion to add...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found