Skip to content

Commit ace33c3

Browse files
fix: video thumbnail not rendering if video message is sent while offline
1 parent 9e595e5 commit ace33c3

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

package/src/components/Attachment/Gallery.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,17 @@ const GalleryWithContext = <
170170
};
171171

172172
const imagesAndVideos = [...(images || []), ...(videos || [])];
173+
const imagesAndVideosValue = `${images?.length}${videos?.length}${images
174+
?.map((i) => `${i.image_url}${i.thumb_url}`)
175+
.join('')}${videos?.map((i) => `${i.image_url}${i.thumb_url}`).join('')}`;
176+
173177
const { height, invertedDirections, thumbnailGrid, width } = useMemo(
174178
() =>
175179
buildGallery({
176180
images: imagesAndVideos,
177181
sizeConfig,
178182
}),
179-
[imagesAndVideos.length],
183+
[imagesAndVideosValue],
180184
);
181185

182186
if (!imagesAndVideos?.length) return null;

package/src/components/Channel/Channel.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,6 +1270,9 @@ const ChannelWithContext = <
12701270
? await doDocUploadRequest(file, channel)
12711271
: await channel.sendFile(file.uri, file.name, file.type);
12721272
attachment.asset_url = response.file;
1273+
if (response.thumb_url) {
1274+
attachment.thumb_url = response.thumb_url;
1275+
}
12731276
delete attachment.originalFile;
12741277
dbApi.updateMessage({
12751278
message: { ...updatedMessage, cid: channel.cid },

0 commit comments

Comments
 (0)