Skip to content

Commit

Permalink
Prevent the colorHash prop being leaked to the DOM (#882)
Browse files Browse the repository at this point in the history
Fixes „React does not recognize the `colorHash` prop on a DOM element.“ messages.
  • Loading branch information
weeman1337 authored Dec 19, 2024
1 parent b5052a4 commit a1241cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/yellow-seas-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@matrix-widget-toolkit/mui': patch
---

Prevent leak of colorHash prop to the DOM when using an avatar
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export type ElementAvatarProps = {
} & AvatarProps;

const StyledAvatar = styled(Avatar, {
shouldForwardProp: (p) => p !== 'color',
shouldForwardProp: (p: string) => !['color', 'colorHash'].includes(p),
})<{ colorHash: number }>(({ theme, colorHash }) => ({
// increase the specificity of the css selector to override styles of
// chip or button components that provide their own css for avatars.
Expand Down

0 comments on commit a1241cc

Please sign in to comment.