Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgifford/pla assessment #3

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

BobbyGifford
Copy link

Description

The logic for posting a new message was not properly updating state. I updated it so rather than mutating the current data, state is now updated when a message is created.

I added a seen property to the Message schema, to indicate unread messages.

I also added a useEffect to update messages in conversations as read when the conversation is opened.

Notes on your approach and thought process

I could tell that the initial bugs were state related because the correct values would appear after a refresh. I've personally seen this issue within React many times.

I also implemented a bulk update for reading messages based on if a conversation is opened. If a conversation is opened, all the messages are read.

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