From a7c3fe6d64b5265dc7f9b914f1651e55f6863b2b Mon Sep 17 00:00:00 2001 From: talksik Date: Sat, 18 Jun 2022 10:26:03 -0500 Subject: [PATCH] Update ConversationProvider.tsx --- packages/desktop/src/providers/ConversationProvider.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/desktop/src/providers/ConversationProvider.tsx b/packages/desktop/src/providers/ConversationProvider.tsx index 2502b3c..998ba49 100644 --- a/packages/desktop/src/providers/ConversationProvider.tsx +++ b/packages/desktop/src/providers/ConversationProvider.tsx @@ -152,6 +152,8 @@ export function ConversationProvider({ children }: { children: React.ReactNode } [setConversationMap, handleConnectToLine, handleTuneIntoLine, user], ); + // add conversations to cache on initial fetch + // the two stores | persistent and socket | are decoupled useEffect(() => { console.log(fetchState.value); @@ -231,6 +233,8 @@ export function ConversationProvider({ children }: { children: React.ReactNode } ], ); + // temporary fix for updated conversation content not being surfaced + // as the map value updates useEffect(() => { if (selectedConversation) { setSelectedConversation(conversationMap[selectedConversation._id.toString()]); @@ -289,9 +293,7 @@ export function ConversationProvider({ children }: { children: React.ReactNode } ); // todo: open up a handler for children - // to refetch or search for a particular conversation and add it to the list of conversations - - // todo: transform conversations to a map and keep adding to the map + // to refetch all conversatinos or search for a particular conversation and add it to the list of conversations if (fetchState.error) { return (