:pref: 首屏优化

This commit is contained in:
zdl
2025-11-26 11:30:12 +08:00
parent 105a0b02ea
commit 7a2c73f3ca
6 changed files with 42 additions and 223 deletions

View File

@@ -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 初始化完成