Skip to content

Commit

Permalink
add console log for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
GayChin committed Apr 17, 2024
1 parent 721f5e3 commit bd6918d
Showing 1 changed file with 1 addition and 43 deletions.
44 changes: 1 addition & 43 deletions app/matches/chatroom/chatroom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,62 +189,20 @@ const Chatroom = () => {
messageId: number,
senderProfileId: number
) => {
console.log('Sending mark as read');
const messagePayload = {
messageId,
senderProfileId,
};

if (stompClient) {
console.log('Sending mark as read : ' + messageId);
stompClient.send('/app/message-read', {}, JSON.stringify(messagePayload));
await markMessageAsRead(messageId);
} else {
console.log("Stomp client for read doesn't exist");
}
};

// useEffect(() => {
// const observer = new IntersectionObserver((entries) => {
// console.log('entries : ', entries.length);
// entries.forEach((entry) => {
// if (entry.isIntersecting) {
// // When any message inside the container enters the viewport
// const messageId = entry.target.getAttribute('data-message-id');
// const senderProfileId =
// entry.target.getAttribute('sender-profile-id');
// const isMessageRead = entry.target.getAttribute('is-message-read');
// console.log('This is message id ', messageId);
// if (
// messageId &&
// senderProfileId === receiverProfileId &&
// isMessageRead === 'N'
// ) {
// handleMessageRead(parseInt(messageId), parseInt(senderProfileId));
// }
// }
// });
// });

// let options = {
// root: document.querySelector('#scrollArea'),
// rootMargin: '0px',
// threshold: 1.0,
// };

// if (messagesContainerRef.current) {
// console.log('observing');

// observer.observe(messagesContainerRef.current);
// }

// // Clean up function
// return () => {
// if (messagesContainerRef.current) {
// observer.unobserve(messagesContainerRef.current);
// }
// };
// }, [messages]); // Now the effect depends on the messages array

useEffect(() => {
let options = {
root: document.querySelector('#scrollArea'),
Expand Down

0 comments on commit bd6918d

Please sign in to comment.