增强应用组件中的ErrorFallback UI,并更新SidebarMenu以实现新的联系人存储集成。重构微信组件,支持虚拟滚动,提升性能。在微信好友组件中实现新的群组管理功能。

This commit is contained in:
2025-12-16 16:24:10 +08:00
parent 3720987997
commit 631e8d00e2
34 changed files with 8406 additions and 408 deletions

View File

@@ -64,7 +64,7 @@ export interface MessageState {
updateCurrentMessage: (message: Message) => void;
// ==================== 新的会话数据接口 ====================
// 当前会话列表
// 当前会话列表(过滤后的,用于显示)
sessions: ChatSession[];
// 设置或更新会话列表(支持回调写法)
setSessions: (updater: SessionsUpdater) => void;
@@ -74,4 +74,37 @@ export interface MessageState {
removeSessionById: (sessionId: number, type: ChatSession["type"]) => void;
// 清空所有会话(登出/切账号使用)
clearSessions: () => void;
// ==================== 新架构索引和缓存阶段1.2 ====================
// 全部会话数据(一次性加载全部)
allSessions: ChatSession[];
// 会话索引accountId -> sessions[]O(1)快速查找)
sessionIndex: Map<number, ChatSession[]>;
// 过滤结果缓存accountId -> filteredSessions[](避免重复计算)
filteredSessionsCache: Map<number, ChatSession[]>;
// 缓存有效性标记accountId -> boolean
cacheValid: Map<number, boolean>;
// 当前选中的账号ID0表示"全部"
selectedAccountId: number;
// 搜索关键词
searchKeyword: string;
// 排序方式
sortBy: "time" | "unread" | "name";
// 设置全部会话数据并构建索引(带缓存)
setAllSessions: (sessions: ChatSession[]) => Promise<void>;
// 从缓存加载会话列表
loadSessionsFromCache: (accountId: number) => Promise<ChatSession[] | null>;
// 构建索引(数据加载时调用)
buildIndexes: (sessions: ChatSession[]) => void;
// 切换账号(使用索引快速过滤)
switchAccount: (accountId: number) => ChatSession[];
// 新增会话(增量更新索引)
addSession: (session: ChatSession) => void;
// 设置搜索关键词
setSearchKeyword: (keyword: string) => void;
// 设置排序方式
setSortBy: (sortBy: "time" | "unread" | "name") => void;
// 失效缓存(数据更新时调用)
invalidateCache: (accountId?: number) => void;
}