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] MotionContext used outside of MotionContextProvider #2282

Closed
gurkerl83 opened this issue Aug 7, 2023 · 2 comments
Closed

[BUG] MotionContext used outside of MotionContextProvider #2282

gurkerl83 opened this issue Aug 7, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@gurkerl83
Copy link

gurkerl83 commented Aug 7, 2023

The MotionComponent initializes the MotionContext.Provider. Within MotionComponent, several initialization functions are executed, such as useCreateMotionContext (which consumes MotionContext), useVisualState (relying on makeUseVisualState that also consumes MotionContext), and useVisualElement.

However, there's a problem that might have been overlooked: accessing MotionContext is invalid since it occurs outside its designated boundary. Context values can only be accessed by its children.

@gurkerl83 gurkerl83 added the bug Something isn't working label Aug 7, 2023
@gurkerl83 gurkerl83 changed the title [BUG] MotionContext used outside of ProviderMotionContextPro [BUG] MotionContext used outside of MotionContextProvider Aug 7, 2023
@mattgperry
Copy link
Collaborator

Can you reopen with a sandbox example of the error?

@gurkerl83
Copy link
Author

gurkerl83 commented Aug 7, 2023

@mattgperry While working with Framer Motion's source code over the past few weeks, I've delved into optimizing its feature loading behavior. Specifically, I've been examining the React-related components of Framer Motion, such as MotionComponent and useVisualElement, which are crucial for initiating the animation skeleton.

Since we cannot reproduce any error from the user's perspective, I request that we reopen the issue.

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

2 participants