diff --git a/app/components/ChatMenu/ChatWindow/EditorModal.tsx b/app/components/ChatMenu/ChatWindow/EditorModal.tsx index 4ae8d13..bc077a9 100644 --- a/app/components/ChatMenu/ChatWindow/EditorModal.tsx +++ b/app/components/ChatMenu/ChatWindow/EditorModal.tsx @@ -94,7 +94,7 @@ const EditorModal: React.FC = ({ id, isLastMessage, setEditMode, ed {entry?.name} - {swipe.send_date.toLocaleTimeString()} + {swipe?.send_date.toLocaleTimeString()} { const message = useEntryData(index) const swipe_index = message.swipe_id - const swipe = message.swipes?.[swipe_index] - const swipeText = swipe?.swipe - const swipeId = swipe?.id + const { swipe, swipeText, swipeId } = useChatState( + useShallow((state) => ({ + swipe: state?.data?.messages?.[index].swipes[swipe_index], + swipeText: state?.data?.messages?.[index].swipes[swipe_index].swipe ?? '', + swipeId: state?.data?.messages?.[index].swipes[swipe_index].id, + })) + ) return { swipeId, swipe, swipeText } }