fix(HH-576): normalize realtime message timestamps (#148)

Co-authored-by: Rogee <rogee@ipao.vip>
This commit is contained in:
Rogee
2026-08-24 10:16:22 +08:00
committed by GitHub
co-authored by rogee
parent 83e2a8ead6
commit b981cc6811
5 changed files with 202 additions and 7 deletions
@@ -13,6 +13,7 @@ import {
import { ON_CONVERSATION_CREATED } from 'widget/constants/widgetBusEvents';
import { createTemporaryMessage, getNonDeletedMessages } from './helpers';
import { emitter } from 'shared/helpers/mitt';
import { isNewerTimestamp } from 'shared/helpers/timeHelper';
export const actions = {
createConversation: async ({ commit, dispatch }, params) => {
commit('setConversationUIFlag', { isCreating: true });
@@ -178,9 +179,8 @@ export const actions = {
const currentMessage = state?.conversations?.[id];
const isNew = !currentMessage;
if (
currentMessage?.updated_at &&
data.updated_at &&
data.updated_at <= currentMessage.updated_at
currentMessage &&
!isNewerTimestamp(currentMessage.updated_at, data.updated_at)
) {
return { applied: false, isNew };
}