fix: Update reply ID handling in message deletion logic

This commit is contained in:
2025-06-19 15:19:06 +05:30
parent 5c91a03225
commit 7da2137117
2 changed files with 4 additions and 5 deletions

View File

@@ -157,15 +157,16 @@ const Messages: React.FC<MessageProps> = ({ val, i, setMessages, mode, setIsEdit
}
setMessages(prev => prev.filter(message => message._id !== (val as Reply)._id))
removeReply(selectedComment?.threadId, (val as Reply)._id ?? "") // Remove listener after response
setMessages(prev => prev.filter(message => message.replyId !== (val as Reply).replyId))
console.log('(val as Reply).replyId): ', (val as Reply).replyId);
removeReply(selectedComment?.threadId, (val as Reply).replyId || ((val as Reply)._id ?? "")) // Remove listener after response
threadSocket.emit("v1-Comment:delete", deleteComment);
}
} catch {
}
}
return (
<>

View File

@@ -14,8 +14,6 @@ interface ThreadSocketProps {
}
const ThreadSocketResponsesDev = ({ setMessages, createComments, modeRef, setCreateComments, messages }: ThreadSocketProps) => {
console.log('mode: ', modeRef);
// console.log('messages:soc ', messages);
const { threadSocket } = useSocketStore();
const { selectedComment, setSelectedComment, setCommentPositionState, commentPositionState } = useSelectedComment();
const { comments, addComment, addReply, updateComment, updateReply } = useCommentStore();