Skip to content

Messenger Starter - Kris - #4

Open
k-milan wants to merge 8 commits into
hatchways:mainfrom
k-milan:kris/messenger-test
Open

Messenger Starter - Kris#4
k-milan wants to merge 8 commits into
hatchways:mainfrom
k-milan:kris/messenger-test

Conversation

@k-milan

@k-milan k-milan commented May 28, 2026

Copy link
Copy Markdown

Description

Implemented fixes and improvements for message handling in the chat app.

Changes include:

Fixed optimistic updates when sending messages in new and existing conversations.
Fixed message ordering so chat messages display in the expected order.
Added conversation-level read tracking using user1LastReadMessageId and user2LastReadMessageId.
Added read receipt UI by showing the other user’s avatar under the last message they have read.
Added backend support for marking a conversation as read.
Added notes for webhook ingestion architecture in architecture.md.

Notes on your approach and thought process

For the message rendering bug, I found that the frontend was mutating the existing conversations state directly with forEach and then passing the same array reference back into state. React may not detect that as a meaningful state change, so I changed the updates to use immutable state updates with setConversations.

For read receipts, I considered message-level read fields first, but chose a conversation-level read pointer because the UI only needs to know the latest message each user has read. This avoids updating multiple message rows and makes the frontend check straightforward.

I also made sure read receipts are only triggered when the user actually opens a conversation or is actively viewing the conversation when a new message arrives.

@k-milan k-milan changed the title Kris/messenger test Messenger Starter - Kris May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant