Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] LazyMotion sets initial immediately; before LazyMotion.features load #2601

Open
o-alexandrov opened this issue Mar 29, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@o-alexandrov
Copy link

o-alexandrov commented Mar 29, 2024

According to docs, LazyMotion:

animation will run when loadFeatures resolves.

However, initial part of MotionProps is set immediately.

<m.div initial={{ opacity: 0 }} animate={{ opacity: 1 }}>{children}</m.div>

Problems:

  1. The user won't see the content until LazyMotion.features are loaded.
  2. It decreases the value of bundle splitting (due to PageSpeed First Contentful Paint; the content is not visible).

CodeSandbox reproduction of the bug

https://codesandbox.io/p/sandbox/framer-motion-lazymotion-32vhxp

Steps to reproduce

Steps to reproduce the behavior:

  1. Open CodeSandbox
  2. See the bug: there's no Hello printed on the screen because initial is triggered immediately

Expected behavior

If LazyMotion.features are loaded, only then initial, animate, exit and other MotionProps should trigger.

  • if the element with initial is already mounted, initial should be skipped
@o-alexandrov o-alexandrov added the bug Something isn't working label Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant