From 77f3949fe21d9cf1902c8657d38d0d0aa7843f89 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Wed, 26 Nov 2025 10:54:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=A6=96=E9=A1=B5=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=80=A7=E8=83=BD=E7=9B=91=E6=8E=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.js | 6 ++++++ src/index.js | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/App.js b/src/App.js index cb045fc7..6b09fd81 100755 --- a/src/App.js +++ b/src/App.js @@ -31,6 +31,7 @@ import { initializePostHog } from './store/slices/posthogSlice'; // Utils import { logger } from './utils/logger'; +import { performanceMonitor } from './utils/performanceMonitor'; // PostHog 追踪 import { trackEvent, trackEventAsync } from '@lib/posthog'; @@ -57,6 +58,11 @@ function AppContent() { logger.info('App', 'PostHog Redux 初始化已触发'); }, [dispatch]); + // ⚡ 性能监控:标记 React 初始化完成 + useEffect(() => { + performanceMonitor.mark('react-ready'); + }, []); + // ✅ 首次访问追踪 useEffect(() => { const hasVisited = localStorage.getItem('has_visited'); diff --git a/src/index.js b/src/index.js index 9c520b75..c27182df 100755 --- a/src/index.js +++ b/src/index.js @@ -3,6 +3,10 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import { BrowserRouter as Router } from 'react-router-dom'; +// ⚡ 性能监控:在应用启动时尽早标记 +import { performanceMonitor } from './utils/performanceMonitor'; +performanceMonitor.mark('app-start'); + // 导入 Brainwave 样式(空文件,保留以避免错误) import './styles/brainwave.css';