fix(ui/api): resolve critical crashes and routing issues in admin mode #606
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📝 Description | 描述
English: Fixed critical UI crashes and API routing configuration issues that prevented proper functionality in admin mode. This PR resolves three interconnected bugs: AILearning component crashes due to null pointer access, equity-history API 404 errors due to incorrect route configuration, and competition API unavailability in admin mode.
中文: 修复了管理员模式下阻止正常功能的关键UI崩溃和API路由配置问题。此PR解决了三个相互关联的bug:由于空指针访问导致的AILearning组件崩溃、由于路由配置错误导致的equity-history API 404错误,以及管理员模式下竞赛API不可用的问题。
🎯 Type of Change | 变更类型
🔗 Related Issues | 相关 Issue
📋 Changes Made | 具体变更
English:
web/src/App.tsx): Added null safety check forselectedTraderbefore rendering AILearning component to prevent runtime crashesapi/server.go): Moved/api/equity-historyfrom public to protected routes to ensure proper authentication contextapi/server.go): Moved public competition APIs outside admin mode conditional to ensure availability in all deployment modes中文:
web/src/App.tsx): 在渲染AILearning组件前添加selectedTrader空值检查,防止运行时崩溃api/server.go): 将/api/equity-history从公开路由移动到受保护路由,确保正确的认证上下文api/server.go): 将公开竞赛API移出管理员模式条件判断,确保在所有部署模式下都可用🧪 Testing | 测试
Test Results | 测试结果:
✅ Checklist | 检查清单
Code Quality | 代码质量
Documentation | 文档
Git
devbranch | 已 rebase 到最新dev分支📚 Additional Notes | 补充说明
English:
Root Cause Analysis | 根本原因分析
selectedTraderwas undefined during async data loading, causing property access errorshandleEquityHistoryrequired authentication context but was placed in public routesSecurity Considerations | 安全考虑
Backward Compatibility | 向后兼容性
中文:
根本原因分析
selectedTrader为undefined,导致属性访问错误handleEquityHistory需要认证上下文但被放置在公开路由中安全考虑
向后兼容性
By submitting this PR, I confirm | 提交此 PR,我确认:
🌟 Thank you for your contribution! | 感谢你的贡献!