on unmount take care although every should disconnect on firebase since we don't mount and unmount this component much

This commit is contained in:
talksik
2022-05-29 12:31:34 -05:00
parent 3bfe288525
commit 70e78dd00b
+5 -1
View File
@@ -227,7 +227,11 @@ export function TerminalProvider({ children }: { children?: React.ReactNode }) {
// TODO: future work/optimization
// if we removed a conversation, unsubscribe from content listener as well
}, [conversationMap, updatecontentMap, enqueueSnackbar, setContentListeners]);
return () => {
Object.values(contentListeners).forEach((unsub) => unsub());
};
}, [conversationMap, updatecontentMap, enqueueSnackbar, setContentListeners, contentListeners]);
// cache of selected conversation
const selectedConversation: Conversation | undefined = useMemo(() => {