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

[PAY-3456] Fix chat last message sometimes wrong #10084

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions packages/common/src/store/pages/chat/slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,13 +486,6 @@ const slice = createSlice({
// triggers saga to get chat if not exists
const { chatId, message, status, isSelfMessage } = action.payload

// If no chatId, don't add the message
// and abort early, relying on the saga
// to fetch the chat
if (!(chatId in state.messages)) {
return
}

// Always update the last message, but don't update
// last_message_at if it's a blast message sent by current user,
// to avoid chat list re-sorting.
Expand All @@ -513,6 +506,13 @@ const slice = createSlice({
changes
})

// If no chatId, don't add the message
// and abort early, relying on the saga
// to fetch the chat
if (!(chatId in state.messages)) {
return
}

// Return early if we've seen this message: don't update
// recheck_permissions unless it's a message received from someone else
const existingMessage = getMessage(
Expand Down