Repository navigation
🐛 Fixed settings sidebar flash for editors/contributors - #29660
Conversation
WalkthroughThe settings route now declares Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 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
🧹 Nitpick comments (1)
apps/admin/src/layout/sidebar.acceptance.test.tsx (1)
103-112: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAlso verify sidebar restoration after leaving settings.
The new test confirms collapse but not the required return to an expanded sidebar on Posts. Add navigation back to Posts and assert
isShellNavVisible()becomestrue.🤖 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 `@apps/admin/src/layout/sidebar.acceptance.test.tsx` around lines 103 - 112, Add a navigation step in the “collapses the outer admin sidebar on settings routes” test after confirming the settings sidebar is hidden, navigate to Posts, then poll sidebarScreen.isShellNavVisible until it is true to verify the sidebar is restored.
🤖 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 `@apps/admin/src/layout/admin-layout.tsx`:
- Around line 35-38: Update the admin layout’s AppSidebar rendering so hidden
routes retain only the non-effectful mounted shell, while AppSidebarContent and
AppSidebarFooter are excluded when sidebarVisible is false. Gate the sidebar’s
data/banner hooks and navigation content on sidebarVisible, preserving the
mounted shell needed for transition stability.
---
Nitpick comments:
In `@apps/admin/src/layout/sidebar.acceptance.test.tsx`:
- Around line 103-112: Add a navigation step in the “collapses the outer admin
sidebar on settings routes” test after confirming the settings sidebar is
hidden, navigate to Posts, then poll sidebarScreen.isShellNavVisible until it is
true to verify the sidebar is restored.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: e99448ef-f66e-4397-ad2b-e85621ad6f74
📒 Files selected for processing (4)
apps/admin/src/layout/admin-layout.tsxapps/admin/src/layout/sidebar.acceptance.test.tsxapps/admin/src/layout/sidebar.screen.tsapps/admin/src/routes.tsx
fixes TryGhost/Ghost#26607 - settings/* relied on the Ember bridge to hide the admin sidebar, and the bridge only reports after the shell has mounted, so loading a URL like /ghost/#/settings/staff painted the sidebar before hiding it - declaring hideAdminSidebar on the route handle instead means the shell reads it from useMatches on the first paint, before the lazy settings chunk resolves - acceptance coverage for both entry points: clicking through from the sidebar footer, and loading a settings URL directly
11e45a3 to
8324695
Compare
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run @tryghost/admin:test:acceptance |
✅ Succeeded | 5m 42s | View ↗ |
nx run-many -t test:unit -p @tryghost/admin,@tr... |
✅ Succeeded | 2m 4s | View ↗ |
nx run ghost-monorepo:lint:boundaries |
✅ Succeeded | 21s | View ↗ |
nx run-many -t lint -p @tryghost/admin,@tryghos... |
✅ Succeeded | 55s | View ↗ |
nx run @tryghost/admin:build |
✅ Succeeded | 17s | View ↗ |
nx run-many --target=build --projects=tag:publi... |
✅ Succeeded | <1s | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-07-29 13:41:26 UTC
9larsons
left a comment
There was a problem hiding this comment.
I reworked this a bit - the only thing I saw was a brief flash, not the whole sidebar, so you'd have to explain how to reproduce that if so. And the changes were a bit overly broad so they are pared back to only the hideAdminSidebar: true prop.
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 `@apps/admin/src/layout/app-sidebar/app-sidebar.tsx`:
- Line 11: Ensure the Sidebar in the app-sidebar component always uses the fixed
"admin-sidebar" test identifier by spreading props before setting data-testid.
Update the JSX attribute order on Sidebar and preserve the existing props and
behavior.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 2247550b-2192-488d-9c0a-cad69d03ba68
📒 Files selected for processing (5)
apps/admin/src/layout/app-sidebar/app-sidebar.tsxapps/admin/src/layout/sidebar.acceptance.test.tsxapps/admin/src/layout/sidebar.screen.tsapps/admin/src/routes.tsxpackages/testing/test-data/src/selectors/sidebar.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- apps/admin/src/layout/sidebar.acceptance.test.tsx
- apps/admin/src/routes.tsx

Loading a settings URL directly —
/ghost/#/settings/staff?tab=editors— painted the admin sidebar for a frame before hiding it.settings/*relied on the Ember bridge to report that the sidebar should be hidden, and the bridge only reports after the React shell has mounted. DeclaringhideAdminSidebaron the route handle instead meansuseAdminSidebarVisibilityreads it fromuseMatcheson the first paint, before the lazy settings chunk resolves.ref #26607
Test plan
pnpm test:acceptance src/layout/sidebar.acceptance.test.tsx(fromapps/admin) — covers both entry points; both new assertions fail without the handle change#/settings/staff?tab=editorsin a fresh tab — no sidebar frame before settings renders