Skip to content

Commit

Permalink
[PAY-3456] Fix chat last message sometimes wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
dharit-tan committed Oct 16, 2024
1 parent 3ae1af1 commit a0ee1f7
Showing 1 changed file with 7 additions and 7 deletions.
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

0 comments on commit a0ee1f7

Please sign in to comment.