From 12d0e6aed8929dfebfd87828ad7d0962a5b0ec7f Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sat, 7 Oct 2023 09:41:38 +0800 Subject: [PATCH] Fix media caption and index not synced --- src/components/status.jsx | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/components/status.jsx b/src/components/status.jsx index 81075576..8477ef2e 100644 --- a/src/components/status.jsx +++ b/src/components/status.jsx @@ -876,6 +876,11 @@ function Status({ 0, isSizeLarge ? undefined : 4, ); + const showMultipleMediaCaptions = + mediaAttachments.length > 1 && + displayedMediaAttachments.some( + (media) => !!media.description && !isMediaCaptionLong(media.description), + ); return (
1 && - displayedMediaAttachments.some( - (media) => - !!media.description && - !isMediaCaptionLong(media.description), - ) - } + enabled={showMultipleMediaCaptions} captionChildren={() => { return displayedMediaAttachments.map( (media, i) => @@ -1317,9 +1315,7 @@ function Status({ showCaption={mediaAttachments.length === 1} lang={language} altIndex={ - mediaAttachments.length > 1 && - !!media.description && - i + 1 + showMultipleMediaCaptions && !!media.description && i + 1 } to={`/${instance}/s/${id}?${ withinContext ? 'media' : 'media-only'