Skip to content

🐛 Fixed settings routes not hiding the outer admin sidebar - #29596

Closed
jatinder14 wants to merge 2 commits into
TryGhost:mainfrom
jatinder14:fix/editor-staff-settings-permissions
Closed

jatinder14 wants to merge 2 commits into
TryGhost:mainfrom
jatinder14:fix/editor-staff-settings-permissions

Conversation

@jatinder14

@jatinder14 jatinder14 commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Settings is rendered as a full-screen surface, but settings/* did not set hideAdminSidebar: true, so the outer admin shell sidebar stayed mounted underneath.
  • That matches the Editor experience in Editor opening staff settings/profile triggers forbidden API calls and unrelated permission toast #26607: sidebar looked present but clicks/nav were dead, and sidebar hooks (including member-count) kept running under the settings portal.
  • useMemberCount is already permission-gated on main; this PR fixes the remaining settings-route sidebar visibility hole.

fixes #26607

Test plan

  • pnpm exec vitest run src/layout/sidebar-visibility.test.tsx (3 passed)
  • pnpm test:acceptance src/layout/sidebar.acceptance.test.tsx (17 passed, including new settings-route assertion)
  • Log in as Editor → open #/settings/staff → confirm outer admin sidebar is hidden and no “browse members” toast from the shell nav

@coderabbitai

coderabbitai Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d1af0df1-5762-4204-a577-2dc7da198378

📥 Commits

Reviewing files that changed from the base of the PR and between 0987c6d and befcc1d.

📒 Files selected for processing (3)
  • apps/admin/src/layout/sidebar.acceptance.test.tsx
  • apps/admin/src/layout/sidebar.screen.ts
  • apps/admin/src/routes.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/admin/src/routes.tsx

Walkthrough

The settings route now sets hideAdminSidebar: true using AdminRouteHandle. The sidebar screen exposes an isMounted query, and a new acceptance test navigates from the admin root to settings and verifies that the outer sidebar is unmounted.

Suggested reviewers: 9larsons

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: hiding the outer admin sidebar on settings routes.
Description check ✅ Passed The description matches the PR scope and describes the sidebar-hiding fix and related test coverage.
Linked Issues check ✅ Passed The changes address #26607 by marking settings routes to hide the admin sidebar and adding coverage that it unmounts on settings navigation.
Out of Scope Changes check ✅ Passed The PR stays focused on sidebar visibility for settings routes, plus the small test helper needed to verify it.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jatinder14
jatinder14 force-pushed the fix/editor-staff-settings-permissions branch 2 times, most recently from bbe85ac to 0987c6d Compare July 28, 2026 02:51
jatinder14 and others added 2 commits July 28, 2026 11:03
fixes TryGhost/Ghost#26607
- Settings is a full-screen surface; without hideAdminSidebar the shell
  nav stayed mounted so Editors saw a visible-but-dead sidebar (and its
  member-count hooks kept running under the settings portal)

Co-authored-by: Cursor <[email protected]>
no ref

The new assertion passed without the route change: it checked for the
absence of nav links immediately after rendering at /settings, before the
shell had mounted them. Navigate in from / instead and poll the sidebar's
DOM presence, which is red without the fix.
@9larsons
9larsons force-pushed the fix/editor-staff-settings-permissions branch from 0987c6d to befcc1d Compare July 28, 2026 16:14
@9larsons

Copy link
Copy Markdown
Contributor

@jatinder14 Hey, thanks for the PR! While this makes the screen usable, there's a dismount that happens from lazy loading the module that causes some stutter on first load of settings that's not ideal for users, and on top of that, exploring this issue further has unearthed some more complicated gaps in our route access handling. I'm going to take a pass at a more comprehensive fix there as that feels more appropriate than this approach.

@jatinder14

Copy link
Copy Markdown
Contributor Author

Thanks for the clear feedback on the lazy-load remount stutter, and for the route-access pass in #29653.

I opened a follow-up that keeps your access guard and only fills the remaining Editor gap (settings still left the outer shell sidebar under the portal): #29718

Difference from this PR: AdminLayout keeps AppSidebar mounted and collapses via SidebarProvider instead of unmounting on the route toggle, so the first settings visit should not remount the nav tree while the settings chunk loads.

@jatinder14

Copy link
Copy Markdown
Contributor Author

Correction on the link above: the follow-up is #29660 (not 29718).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Editor opening staff settings/profile triggers forbidden API calls and unrelated permission toast

2 participants