feat(flashai): deeplinks and redirects to /flashai/<item> - #2199
Conversation
SideMenu 过滤器此前把每个顶层项都当分组,children 过滤后为空即整项丢弃, 导致顶层叶子项(如 FlashAI,children 为空数组)被误删。渲染器 MenuList 本就 支持将无 children 的项渲染为可点击的 MenuItem,这里补上过滤器的叶子分支: 无 children 时按自身 key 权限决定保留。 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Re-run menu build when getMenuList changes and include top-level leaves in path matching. Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughAI configuration routes conditionally redirect to FlashAI pages for ENT deployments. Side-menu filtering and route selection now support top-level leaf entries, with localized knowledge-base and intelligent-section labels added across supported locales. ChangesFlashAI navigation
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/SideMenu/index.tsx`:
- Around line 230-232: Refactor the menu derivation in the useEffect around
getMenuList to avoid stale derived state, preferably computing menus
synchronously with useMemo from all required inputs, including perms,
hideDeprecatedMenus/menuList, i18n.language, embeddedProductMenu, and
getMenuList. If retaining the effect, add every referenced asynchronous value to
its dependency array and ensure updates are reflected in the side menu.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: cd2f8a2f-e475-4004-aea4-17de0d1139d1
📒 Files selected for processing (10)
src/components/AiChatNG/MessageBlocks.tsxsrc/components/OnboardingProgress/tracks.tssrc/components/SideMenu/index.tsxsrc/components/SideMenu/locale/en_US.tssrc/components/SideMenu/locale/ja_JP.tssrc/components/SideMenu/locale/ru_RU.tssrc/components/SideMenu/locale/zh_CN.tssrc/components/SideMenu/locale/zh_HK.tssrc/components/SideMenu/types.tssrc/pages/aiConfig/entry.tsx
| // getMenuList must stay in deps: ENT builds recreate it when async inputs | ||
| // (e.g. aiStatus) arrive; without it the FlashAI entry can be missed forever. | ||
| }, [i18n.language, embeddedProductMenu, getMenuList]); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Add missing dependencies or refactor to useMemo to prevent stale menus.
The useEffect block relies on variables from the component scope (like perms and implicitly hideDeprecatedMenus via menuList) that are missing from the dependency array. If these values are loaded or updated asynchronously from commonState after the component mounts, the side menu will not update to reflect the changes.
To prevent stale state, either add perms and menuList (or its dependencies) to the dependency array, or better yet, eliminate the derived state entirely by computing menus synchronously during render via useMemo.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/components/SideMenu/index.tsx` around lines 230 - 232, Refactor the menu
derivation in the useEffect around getMenuList to avoid stale derived state,
preferably computing menus synchronously with useMemo from all required inputs,
including perms, hideDeprecatedMenus/menuList, i18n.language,
embeddedProductMenu, and getMenuList. If retaining the effect, add every
referenced asynchronous value to its dependency array and ensure updates are
reflected in the side menu.
Summary
/flashai/<item>paths./ai-config/*list routes into FlashAI host.aiStatusarrives late; i18n for intelligent section / knowledge-base.Review
origin/main...HEAD(6 commits, ~10 files): redirects and menu leaf filter look scoped; no unrelated churn.Verification
Notes / Risks
Made with Cursor
Summary by CodeRabbit