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

fix: don't pass custom props to motion.div #88783

Merged
merged 1 commit into from
Apr 4, 2025

Conversation

TkDodo
Copy link
Contributor

@TkDodo TkDodo commented Apr 4, 2025

From the emotion docs:

By default, Emotion passes all props (except for theme) to custom components and only props that are valid html attributes for string tags.

motion.div is a custom component, so the displayTime ends up in the dom, yielding this warning:

Screenshot 2025-04-04 at 11 23 13

This PR ensures we don’t forward displayType, as it’s only used to do custom styling inside the styled component.

@TkDodo TkDodo marked this pull request as ready for review April 4, 2025 09:28
@TkDodo TkDodo requested a review from a team as a code owner April 4, 2025 09:28
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 4, 2025
@DominikB2014 DominikB2014 merged commit 8ac7f43 into master Apr 4, 2025
42 checks passed
@DominikB2014 DominikB2014 deleted the tkdodo/fix/prop-forwarding branch April 4, 2025 20:06
andrewshie-sentry pushed a commit that referenced this pull request Apr 8, 2025
[From the emotion
docs](https://emotion.sh/docs/styled#customizing-prop-forwarding):

> By default, Emotion passes all props (except for theme) to custom
components and only props that are valid html attributes for string
tags.

`motion.div` is a custom component, so the `displayTime` ends up in the
dom, yielding this warning:

![Screenshot 2025-04-04 at 11 23
13](https://github.com/user-attachments/assets/845a8d9b-3613-4f07-97fe-ad27d1ae3f09)

This PR ensures we don’t forward `displayType`, as it’s only used to do
custom styling inside the styled component.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants