Skip to content

Commit f9f69b9

Browse files
committed
fix: loader when attachment is pending download is now shown
1 parent b3980dd commit f9f69b9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ts/components/conversation/Image.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const Image = (props: Props) => {
8383
const canClick = onClick && !pending;
8484
const role = canClick ? 'button' : undefined;
8585

86-
const onErrorUrlFilterering = useCallback(() => {
86+
const onErrorUrlFiltering = useCallback(() => {
8787
if (mounted && url && urlToLoad === '' && onError) {
8888
onError();
8989
setPending(false);
@@ -96,19 +96,19 @@ export const Image = (props: Props) => {
9696
useEffect(() => {
9797
if (mounted && url === '') {
9898
setPending(false);
99-
onErrorUrlFilterering();
99+
onErrorUrlFiltering();
100100
}
101101

102102
if (mounted && imageBroken && urlToLoad === '') {
103103
setPending(false);
104-
onErrorUrlFilterering();
104+
onErrorUrlFiltering();
105105
}
106106

107107
if (url) {
108108
setPending(false);
109109
setMounted(!loading && !pending);
110110
}
111-
}, [imageBroken, loading, mounted, onErrorUrlFilterering, pending, url, urlToLoad]);
111+
}, [imageBroken, loading, mounted, onErrorUrlFiltering, pending, url, urlToLoad]);
112112

113113
if (mounted && imageBroken) {
114114
return (
@@ -145,7 +145,7 @@ export const Image = (props: Props) => {
145145
}}
146146
data-attachmentindex={attachmentIndex}
147147
>
148-
{!mounted ? (
148+
{!mounted || !urlToLoad ? (
149149
<div
150150
className="module-image__loading-placeholder"
151151
style={{
@@ -161,7 +161,7 @@ export const Image = (props: Props) => {
161161
</div>
162162
) : (
163163
<img
164-
onError={onErrorUrlFilterering}
164+
onError={onErrorUrlFiltering}
165165
className={clsx('module-image__image', forceSquare ? 'module-image__image-cover' : '')}
166166
alt={alt}
167167
style={{

0 commit comments

Comments
 (0)