update pay ui
This commit is contained in:
@@ -64,6 +64,11 @@ import MyFutureEvents from './components/MyFutureEvents';
|
||||
import InvestmentPlanningCenter from './components/InvestmentPlanningCenter';
|
||||
|
||||
export default function CenterDashboard() {
|
||||
// 🔍 性能调试:记录组件渲染
|
||||
const renderCountRef = React.useRef(0);
|
||||
renderCountRef.current += 1;
|
||||
console.log(`[Center] 🔄 渲染次数: ${renderCountRef.current}`, new Date().toISOString());
|
||||
|
||||
const { user } = useAuth();
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
@@ -96,6 +101,8 @@ export default function CenterDashboard() {
|
||||
const [quotesLoading, setQuotesLoading] = useState(false);
|
||||
|
||||
const loadData = useCallback(async () => {
|
||||
console.log('[Center] 📡 loadData 被调用', new Date().toISOString());
|
||||
console.trace('[Center] loadData 调用栈');
|
||||
try {
|
||||
const base = getApiBase();
|
||||
const ts = Date.now();
|
||||
@@ -218,19 +225,37 @@ export default function CenterDashboard() {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
console.log('[Center] 🔥 useEffect 触发', {
|
||||
userId,
|
||||
prevUserId: prevUserIdRef.current,
|
||||
pathname: location.pathname,
|
||||
hasUser: !!user,
|
||||
time: new Date().toISOString()
|
||||
});
|
||||
|
||||
const userIdChanged = prevUserIdRef.current !== userId;
|
||||
|
||||
if (userIdChanged) {
|
||||
console.log('[Center] ⚠️ userId 发生变化:', prevUserIdRef.current, '->', userId);
|
||||
prevUserIdRef.current = userId;
|
||||
}
|
||||
|
||||
// 只在 userId 真正变化或路径变化时加载数据
|
||||
if ((userIdChanged || !prevUserIdRef.current) && user && location.pathname.includes('/home/center')) {
|
||||
const shouldLoad = (userIdChanged || !prevUserIdRef.current) && user && location.pathname.includes('/home/center');
|
||||
console.log('[Center] 🤔 是否应该加载数据:', shouldLoad, {
|
||||
userIdChanged,
|
||||
prevUserIdRef: prevUserIdRef.current,
|
||||
hasUser: !!user,
|
||||
pathMatch: location.pathname.includes('/home/center')
|
||||
});
|
||||
|
||||
if (shouldLoad) {
|
||||
loadData();
|
||||
}
|
||||
|
||||
const onVis = () => {
|
||||
if (document.visibilityState === 'visible' && location.pathname.includes('/home/center')) {
|
||||
console.log('[Center] 👁️ visibilitychange 触发 loadData');
|
||||
loadData();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -70,6 +70,11 @@ const PanelLoadingFallback: React.FC = () => (
|
||||
* InvestmentPlanningCenter 主组件
|
||||
*/
|
||||
const InvestmentPlanningCenter: React.FC = () => {
|
||||
// 🔍 性能调试
|
||||
const renderCountRef = React.useRef(0);
|
||||
renderCountRef.current += 1;
|
||||
console.log(`[InvestmentPlanningCenter] 🔄 渲染次数: ${renderCountRef.current}`, new Date().toISOString());
|
||||
|
||||
const toast = useToast();
|
||||
|
||||
// 颜色主题
|
||||
@@ -88,6 +93,7 @@ const InvestmentPlanningCenter: React.FC = () => {
|
||||
* 加载所有事件数据(日历事件 + 计划 + 复盘)
|
||||
*/
|
||||
const loadAllData = useCallback(async (): Promise<void> => {
|
||||
console.log('[InvestmentPlanningCenter] 📡 loadAllData 被调用', new Date().toISOString());
|
||||
try {
|
||||
setLoading(true);
|
||||
const base = getApiBase();
|
||||
|
||||
Reference in New Issue
Block a user