Skip to content

Commit

Permalink
[Avatar] Fix flashing of broken image (#2340)
Browse files Browse the repository at this point in the history
* [Avatar] Fix flashing of broken image

* Use isomorphic `useLayoutEffect`

* [Avatar] Bump patch version
  • Loading branch information
lesha1201 committed Aug 16, 2023
1 parent 3e0642e commit baf9862
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .yarn/versions/64fcd132.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
releases:
"@radix-ui/react-avatar": patch

declined:
- primitives
2 changes: 1 addition & 1 deletion packages/react/avatar/src/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ AvatarFallback.displayName = FALLBACK_NAME;
function useImageLoadingStatus(src?: string) {
const [loadingStatus, setLoadingStatus] = React.useState<ImageLoadingStatus>('idle');

React.useEffect(() => {
useLayoutEffect(() => {
if (!src) {
setLoadingStatus('error');
return;
Expand Down

0 comments on commit baf9862

Please sign in to comment.