:pref: 首屏优化
This commit is contained in:
11
src/App.js
11
src/App.js
@@ -53,10 +53,15 @@ function AppContent() {
|
||||
const pageEnterTimeRef = useRef(Date.now());
|
||||
const currentPathRef = useRef(location.pathname);
|
||||
|
||||
// 🎯 PostHog Redux 初始化
|
||||
// 🎯 PostHog Redux 初始化(延迟执行,不阻塞首屏)
|
||||
useEffect(() => {
|
||||
dispatch(initializePostHog());
|
||||
logger.info('App', 'PostHog Redux 初始化已触发');
|
||||
// ⚡ 延迟 2 秒初始化 PostHog,确保首屏渲染不被阻塞
|
||||
const timer = setTimeout(() => {
|
||||
dispatch(initializePostHog());
|
||||
logger.info('App', 'PostHog Redux 初始化已触发(延迟 2 秒)');
|
||||
}, 2000);
|
||||
|
||||
return () => clearTimeout(timer);
|
||||
}, [dispatch]);
|
||||
|
||||
// ⚡ 性能监控:标记 React 初始化完成
|
||||
|
||||
Reference in New Issue
Block a user