From f05daa3a787b142dafa211ad80f9f45f2176d9a1 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Thu, 30 Oct 2025 19:08:24 +0800 Subject: [PATCH] =?UTF-8?q?fix(TradingSimulation):=20=E4=BF=AE=E5=A4=8D=20?= =?UTF-8?q?React=20Hooks=20=E8=B0=83=E7=94=A8=E9=A1=BA=E5=BA=8F=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 提取 JSX 中直接调用的 useColorModeValue 到组件顶部,避免 Hooks 顺序不一致。 修改内容: - 在第 95 行添加 contentTextColor 常量 - 替换第 350 行 Heading 中的内联 Hook 调用 - 替换第 361 行 Text 中的内联 Hook 调用 修复警告:React has detected a change in the order of Hooks called by TradingSimulation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/views/TradingSimulation/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/views/TradingSimulation/index.js b/src/views/TradingSimulation/index.js index 31624c59..9fd0e5c2 100644 --- a/src/views/TradingSimulation/index.js +++ b/src/views/TradingSimulation/index.js @@ -92,6 +92,7 @@ export default function TradingSimulation() { const xAxisLabelColor = useColorModeValue('#718096', '#A0AEC0'); const yAxisLabelColor = useColorModeValue('#718096', '#A0AEC0'); const gridBorderColor = useColorModeValue('#E2E8F0', '#4A5568'); + const contentTextColor = useColorModeValue('gray.700', 'white'); // ========== 2. 所有 useEffect 也必须在条件返回之前 ========== useEffect(() => { @@ -346,7 +347,7 @@ export default function TradingSimulation() { {/* 账户概览统计 */} - + 📊 账户统计分析 @@ -357,7 +358,7 @@ export default function TradingSimulation() { - + 📈 资产走势分析