fix(weChat): 修复消息加载顺序和加载状态显示问题

调整消息数组拼接顺序,确保新消息正确追加
添加加载状态图标并优化加载更多消息的逻辑
设置消息加载状态延迟更新以避免闪烁
This commit is contained in:
超级老白兔
2025-09-08 10:30:22 +08:00
parent 8682cdab51
commit b84a3255c6
2 changed files with 37 additions and 6 deletions

View File

@@ -72,8 +72,8 @@ export const useWeChatStore = create<WeChatState>()(
} else {
set({
currentMessages: [
...state.currentMessages,
...(messages || []),
...state.currentMessages,
],
});
}
@@ -85,8 +85,8 @@ export const useWeChatStore = create<WeChatState>()(
} else {
set({
currentMessages: [
...state.currentMessages,
...(messages || []),
...state.currentMessages,
],
});
}
@@ -94,7 +94,9 @@ export const useWeChatStore = create<WeChatState>()(
} catch (error) {
console.error("获取聊天消息失败:", error);
} finally {
set({ messagesLoading: false });
setTimeout(() => {
set({ messagesLoading: false });
}, 1500);
}
},