From 88e28511b6152f6031549437d04c6ee4aec18b4e Mon Sep 17 00:00:00 2001 From: Anirban Singha <143536290+SinghaAnirban005@users.noreply.github.com> Date: Sun, 22 Dec 2024 15:31:05 +0530 Subject: [PATCH] fix: update file list immediately after deletion to reflect changes in UI (#695) Co-authored-by: Zishan Ahmad --- packages/react/src/views/MessageAggregators/FileGallery.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/react/src/views/MessageAggregators/FileGallery.js b/packages/react/src/views/MessageAggregators/FileGallery.js index cf9960c49..606add5f0 100644 --- a/packages/react/src/views/MessageAggregators/FileGallery.js +++ b/packages/react/src/views/MessageAggregators/FileGallery.js @@ -1,6 +1,6 @@ import React, { useState, useMemo, useEffect } from 'react'; import { useComponentOverrides } from '@embeddedchat/ui-elements'; -import { useChannelStore } from '../../store'; +import { useChannelStore, useMessageStore } from '../../store'; import { useRCContext } from '../../context/RCInstance'; import { MessageAggregator } from './common/MessageAggregator'; @@ -10,6 +10,7 @@ const FileGallery = () => { const viewType = variantOverrides.viewType || 'Sidebar'; const isChannelPrivate = useChannelStore((state) => state.isChannelPrivate); + const messages = useMessageStore((state) => state.messages); const [text, setText] = useState(''); const [isFetching, setIsFetching] = useState(true); @@ -39,7 +40,7 @@ const FileGallery = () => { } }; fetchAllFiles(); - }, [RCInstance, isChannelPrivate]); + }, [RCInstance, isChannelPrivate, messages]); return (