zdl
ee37efb8df
fix(community): 修复 React Hooks 顺序错误
将 Alert 组件中的 useColorModeValue Hook 调用提取到组件顶层,
避免在条件渲染中调用 Hook 导致的顺序变化问题。
## 问题
- useColorModeValue 在 showNotificationBanner 条件渲染内部调用
- 当条件状态变化时,Hooks 调用顺序发生改变
- 触发 React 警告:Hooks 顺序改变(第 75 个 Hook 从 undefined 变为 useContext)
## 解决方案
- 将 alertBgColor 和 alertBorderColor 提取到组件顶层
- 确保所有 Hooks 在每次渲染时以相同顺序调用
- 符合 React Hooks 规则:只在顶层调用 Hooks
## 变更文件
src/views/Community/index.js:
- 新增 alertBgColor 常量(第 47 行)
- 新增 alertBorderColor 常量(第 48 行)
- Alert 组件使用变量替代直接调用 Hook
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-11 20:20:57 +08:00
..
2025-11-10 08:14:53 +08:00
2025-10-31 10:33:53 +08:00
2025-11-11 20:20:57 +08:00
2025-10-28 21:52:27 +08:00
2025-10-31 15:05:15 +08:00
2025-10-31 10:33:53 +08:00
2025-11-07 20:05:14 +08:00
2025-10-31 10:33:53 +08:00
2025-10-29 19:08:51 +08:00
2025-10-20 21:25:33 +08:00
2025-10-29 12:29:41 +08:00
2025-10-29 12:29:41 +08:00
2025-10-30 18:59:49 +08:00
2025-10-30 19:08:24 +08:00