diff --git a/src/components/account.tsx b/src/components/account.tsx index 4871079a7..ddee09385 100644 --- a/src/components/account.tsx +++ b/src/components/account.tsx @@ -1,4 +1,4 @@ -import React, { useRef } from 'react'; +import React, { useRef, useState } from 'react'; import { defineMessages, useIntl, FormattedMessage } from 'react-intl'; import { Link, useHistory } from 'react-router-dom'; @@ -27,6 +27,9 @@ const messages = defineMessages({ const InstanceFavicon: React.FC = ({ account, disabled }) => { const history = useHistory(); + const [missing, setMissing] = useState(false); + + const handleError = () => setMissing(true); const handleClick: React.MouseEventHandler = (e) => { e.stopPropagation(); @@ -41,7 +44,7 @@ const InstanceFavicon: React.FC = ({ account, disabled }) => { } }; - if (!account.pleroma?.favicon) { + if (missing || !account.pleroma?.favicon) { return null; } @@ -51,7 +54,13 @@ const InstanceFavicon: React.FC = ({ account, disabled }) => { onClick={handleClick} disabled={disabled} > - + ); };