From f0186de1bf4e575a89e327418f7be8c030435a0e Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Tue, 26 Nov 2024 14:23:24 +0700 Subject: [PATCH 1/2] fix: User lands on previous attachment --- .../Attachments/AttachmentCarousel/Pager/index.tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/components/Attachments/AttachmentCarousel/Pager/index.tsx b/src/components/Attachments/AttachmentCarousel/Pager/index.tsx index 0baab49d3010..d1a47fbac8b0 100644 --- a/src/components/Attachments/AttachmentCarousel/Pager/index.tsx +++ b/src/components/Attachments/AttachmentCarousel/Pager/index.tsx @@ -86,10 +86,7 @@ function AttachmentCarouselPager( [activePageIndex, items], ); - const extractItemKey = useCallback( - (item: Attachment) => (typeof item.source === 'string' || typeof item.source === 'number' ? `source-${item.source}|${item.attachmentLink}` : `reportActionID-${item.reportActionID}`), - [], - ); + const extractItemKey = useCallback((item: Attachment) => `reportActionID-${item.reportActionID}`, []); const contextValue = useMemo( () => ({ From 36b9372ec70567f7d8e36a2a720c18e3dd9b286a Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Fri, 6 Dec 2024 16:19:26 +0700 Subject: [PATCH 2/2] fix warning --- src/components/Attachments/AttachmentCarousel/Pager/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Attachments/AttachmentCarousel/Pager/index.tsx b/src/components/Attachments/AttachmentCarousel/Pager/index.tsx index d1a47fbac8b0..e830503d1876 100644 --- a/src/components/Attachments/AttachmentCarousel/Pager/index.tsx +++ b/src/components/Attachments/AttachmentCarousel/Pager/index.tsx @@ -86,7 +86,7 @@ function AttachmentCarouselPager( [activePageIndex, items], ); - const extractItemKey = useCallback((item: Attachment) => `reportActionID-${item.reportActionID}`, []); + const extractItemKey = useCallback((item: Attachment, index: number) => `reportActionID-${item.reportActionID}-${index}`, []); const contextValue = useMemo( () => ({ @@ -122,7 +122,7 @@ function AttachmentCarouselPager( const carouselItems = items.map((item, index) => (