Merge branch 'feature_2025/251209_stock_pref' into feature_bugfix/251217_stock

* feature_2025/251209_stock_pref:
  feat(性能监控): 补全 T0 标记 + PostHog 上报
  fix(MSW): Bytedesk 添加 mock 数据响应
  fix(NotificationContext): Mock 模式下跳过 Socket 连接
This commit is contained in:
zdl
2025-12-17 18:34:12 +08:00
4 changed files with 38 additions and 5 deletions

View File

@@ -661,6 +661,12 @@ export const NotificationProvider = ({ children }) => {
// ========== 连接到 Socket 服务(⚡ 异步初始化,不阻塞首屏) ==========
useEffect(() => {
// ⚡ Mock 模式下跳过 Socket 连接(避免连接生产服务器失败的错误)
if (process.env.REACT_APP_ENABLE_MOCK === 'true') {
logger.debug('NotificationContext', 'Mock 模式,跳过 Socket 连接');
return;
}
// ⚡ 防止 React Strict Mode 导致的重复初始化
if (socketInitialized) {
logger.debug('NotificationContext', 'Socket 已初始化跳过重复执行Strict Mode 保护)');