diff --git a/src/pages/pc/ckbox/weChat/components/CustomerList/index.tsx b/src/pages/pc/ckbox/weChat/components/CustomerList/index.tsx index e3eb8fe..f2b3046 100644 --- a/src/pages/pc/ckbox/weChat/components/CustomerList/index.tsx +++ b/src/pages/pc/ckbox/weChat/components/CustomerList/index.tsx @@ -25,7 +25,14 @@ const CustomerList: React.FC = () => { } setLoading(false); }) - .catch(() => { + .catch(error => { + console.error("❌ 获取客服列表失败:", error); + // 即使加载失败,也设置为 null(表示"全部"),避免阻塞会话列表 + const current = useCustomerStore.getState().currentCustomer; + if (current === undefined) { + console.log("🔄 加载失败,降级为全部账号"); + updateCurrentCustomer(null); + } setLoading(false); }); }, []); diff --git a/src/pages/pc/ckbox/weChat/components/SidebarMenu/MessageList/index.tsx b/src/pages/pc/ckbox/weChat/components/SidebarMenu/MessageList/index.tsx index 5971318..3b773a8 100644 --- a/src/pages/pc/ckbox/weChat/components/SidebarMenu/MessageList/index.tsx +++ b/src/pages/pc/ckbox/weChat/components/SidebarMenu/MessageList/index.tsx @@ -113,7 +113,17 @@ const MessageList: React.FC = () => { // 调试日志:检查会话列表状态 useEffect(() => { - if (displaySessions.length === 0) { + // 只在以下情况才警告: + // 1. 会话列表为空 + // 2. 已经完成过至少一次加载 + // 3. currentCustomer 不是 undefined(已加载客服列表) + // 4. 不在同步中 + if ( + displaySessions.length === 0 && + hasLoadedOnce && + currentCustomer !== undefined && + !syncing + ) { console.warn("⚠️ 会话列表为空,调试信息:", { storeSessionsLength: storeSessions.length, filteredSessionsLength: filteredSessions.length,