fix(app-shell): AppSidebar / UnifiedSidebar 区域切换器采用派生可见性(#3319) - #3327
Merged
xuyushun441-sys merged 2 commits intoAug 4, 2026
Conversation
…d area visibility (#3319) Both inline area switchers now reuse @object-ui/layout's hasVisibleNavigationItems predicate (#3311): an area is offered iff at least one of its navigation items survives the item-level guards, and the active area is elected among the VISIBLE areas only (first visible by default; re-elected when the active area is gated away; a mere reveal never steals the user's selection). Also tightens areas: any[] to NavigationArea[]. No authorable area-level key is introduced. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVPjPzmmAJ2Ngtvgg5MSRa
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVPjPzmmAJ2Ngtvgg5MSRa
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
xuyushun441-sys
marked this pull request as ready for review
August 4, 2026 01:48
xuyushun441-sys
deleted the
claude/issue-3319-sidebar-derived-visibility
branch
August 4, 2026 01:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #3319
问题
packages/app-shell的AppSidebar与UnifiedSidebar各自内联了一份区域切换器,均无 area 级过滤:某区域内 item 全被 gate(visible表达式 /requiredPermissions/requiresObject/requiresService)时,区域仍出现在切换器里,点进去是空的;若第一个区域全被 gate,用户还会被默认落在空区域上。与 #3311 修掉的AppSchemaRenderer问题同型。修法(按 issue 评论中的 PM 裁决逐条)
@object-ui/layout已导出的hasVisibleNavigationItems:区域可见 iff 其中至少一个 item 能通过NavigationRenderer逐条应用的 item 级守卫,切换器与实际渲染永不打架。差异只在 dispatcher:UnifiedSidebar接了onAction={dispatchNavAction}(framework#4509),action项计为内容(hasActionHandler: !!dispatchNavAction);AppSidebar未接onAction,action项不承重(hasActionHandler: false)。prev仍可见即保留)。渲染期另有?? visibleAreas[0]兜底,覆盖 gating 变化与 effect 重选举之间的那一帧。areas: any[]收紧为NavigationArea[](两处)。顺带把两组件中
evalVis/checkPerm/checkCap的定义位置上移到区域管理之前(谓词需要它们),逻辑未改动。测试
新增两个测试文件(真实
@object-ui/layout+@object-ui/components,仅 mock console providers),两组件各自覆盖:action项计为区域内容(本侧接了 dispatcher)破坏验证实录(改坏 → 红 → 还原 → 绿,每次只改一处):
areas(无派生过滤)areas)areashasActionHandler: false验证命令(仓根,均 flock 串行 + heap 上限):
pnpm exec vitest run packages/app-shell/src/layout/__tests__/AppSidebar.derivedAreaVisibility.test.tsx packages/app-shell/src/layout/__tests__/UnifiedSidebar.derivedAreaVisibility.test.tsx→ 2 files / 13 tests 全绿pnpm exec vitest run --maxWorkers=2 packages/app-shell→ 269 files / 2328 passed, 1 skippedturbo run build --filter=@object-ui/app-shell→ 29 tasks successful(app-shell tsc 干净)turbo run type-check --filter=!@object-ui/site→ 77 tasks successfulturbo run lint --filter=@object-ui/app-shell→ 0 errors(2131 条既有 warning 为存量基线)Changeset
.changeset/app-shell-sidebars-derived-area-visibility.md—@object-ui/app-shell: patch(fixed group,无 major)。未触碰content/docs/releases/。相关
NavigationArea的 area 级visible/requiredPermissions退役前提也不成立 ——AppSchemaRenderer.AreaSwitcher一直在按它过滤 #3311(裁决与 layout 侧实现)/ feat(layout): area 可见性派生自 item 可见性,补掉退役留下的「可见但空」回归 (#3311) #3322(同型修法与测试结构参考)🤖 Generated with Claude Code
https://claude.ai/code/session_01NVPjPzmmAJ2Ngtvgg5MSRa