Skip to content

Commit

Permalink
fix: excessive cpu usage from avatar loading indicator (#1609)
Browse files Browse the repository at this point in the history
* fix: only display spinner icon if loading is true

* fix: styling and add changeset

* chore: tweak changelog

---------

Co-authored-by: Daniel Sinclair <d@niel.nyc>
  • Loading branch information
magiziz and DanielSinclair authored Nov 16, 2023
1 parent bd694e8 commit 39d81e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/tasty-humans-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rainbow-me/rainbowkit": patch
---

Fixed a bug where the avatar loading indicator had used excessive CPU cycles
7 changes: 1 addition & 6 deletions packages/rainbowkit/src/components/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,12 @@ export function Avatar({ address, imageUrl, loading, size }: AvatarProps) {
>
<AvatarComponent address={address} ensImage={imageUrl} size={size} />
</Box>
{typeof loading === 'boolean' && (
{loading && (
<Box
color="accentColor"
display="flex"
height="full"
position="absolute"
style={{
opacity: loading ? 1 : 0,
transition: loading ? '0.6s ease' : '0.2s ease',
transitionDelay: loading ? '.05s' : undefined,
}}
width="full"
>
<SpinnerIcon height="100%" width="100%" />
Expand Down

1 comment on commit 39d81e9

@vercel
Copy link

@vercel vercel bot commented on 39d81e9 Nov 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.