diff --git a/src/soapbox/components/ui/avatar/avatar.tsx b/src/soapbox/components/ui/avatar/avatar.tsx index d2d5f75cd..67e1e02b7 100644 --- a/src/soapbox/components/ui/avatar/avatar.tsx +++ b/src/soapbox/components/ui/avatar/avatar.tsx @@ -1,5 +1,5 @@ import clsx from 'clsx'; -import React, { useState } from 'react'; +import React, { useLayoutEffect, useState } from 'react'; import StillImage, { IStillImage } from 'soapbox/components/still-image'; @@ -21,6 +21,10 @@ const Avatar = (props: IAvatar) => { const handleLoadFailure = () => setIsAvatarMissing(true); + useLayoutEffect(() => { + setIsAvatarMissing(!src); + }, [src]); + const style: React.CSSProperties = React.useMemo(() => ({ width: size, height: size,