smoother flow not duplicating selections

This commit is contained in:
talksik
2022-06-25 15:20:08 -05:00
parent ce9f394e01
commit 2448a4bc5e
@@ -216,6 +216,7 @@ export function ConversationProvider({ children }: { children: React.ReactNode }
* set the temporary sort accordingly
*/
// if we are try to clear or escape most likely
if (!conversationId) {
setSelectedConversation((prevConversation) => {
// untuned from previous line
@@ -233,6 +234,11 @@ export function ConversationProvider({ children }: { children: React.ReactNode }
return;
}
// if we are selecting same one, don't run more logic
if (selectedConversation?._id.toString() === conversationId) {
return;
}
const allConversationIds = Object.keys(conversationMap);
let conversationToSelect: MasterConversation;
@@ -286,6 +292,7 @@ export function ConversationProvider({ children }: { children: React.ReactNode }
[
user,
conversationMap,
selectedConversation,
setSelectedConversation,
setConversationMap,
handleUntuneFromLine,