Skip to content

🐛 Fixed settings sidebar flash for editors/contributors - #29660

Merged
9larsons merged 1 commit into
TryGhost:mainfrom
jatinder14:fix/settings-hide-sidebar-no-unmount
Jul 29, 2026
Merged

9larsons merged 1 commit into
TryGhost:mainfrom
jatinder14:fix/settings-hide-sidebar-no-unmount

Conversation

@jatinder14

@jatinder14 jatinder14 commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

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. Declaring hideAdminSidebar on the route handle instead means useAdminSidebarVisibility reads it from useMatches on the first paint, before the lazy settings chunk resolves.

ref #26607

Test plan

  • pnpm test:acceptance src/layout/sidebar.acceptance.test.tsx (from apps/admin) — covers both entry points; both new assertions fail without the handle change
  • Open #/settings/staff?tab=editors in a fresh tab — no sidebar frame before settings renders
  • Navigate Posts → Settings → back to Posts — sidebar hides and returns

@coderabbitai

coderabbitai Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The settings route now declares hideAdminSidebar: true. The admin sidebar receives an admin-sidebar test identifier, and sidebarScreen adds shell navigation and main-content locators. Acceptance tests verify the shell navigation is visible before navigating to settings, hidden afterward, and hidden when a settings route is loaded directly.

Possibly related PRs

  • TryGhost/Ghost#29596: Updates the settings route and sidebar acceptance coverage for hiding the admin sidebar.

Suggested reviewers: 9larsons

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy the linked issues by hiding the outer admin sidebar on settings routes and covering the regression in tests.
Out of Scope Changes check ✅ Passed The added selectors, test updates, and route handle change all support the stated sidebar-visibility fix.
Title check ✅ Passed The title is concise and accurately summarizes the main change: fixing the settings sidebar flash for editors/contributors.
Description check ✅ Passed The description matches the change set by explaining the direct settings route sidebar flash and the hideAdminSidebar fix.
✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/admin/src/layout/sidebar.acceptance.test.tsx (1)

103-112: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Also 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() becomes true.

🤖 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

📥 Commits

Reviewing files that changed from the base of the PR and between 46aaa05 and 11e45a3.

📒 Files selected for processing (4)
  • apps/admin/src/layout/admin-layout.tsx
  • apps/admin/src/layout/sidebar.acceptance.test.tsx
  • apps/admin/src/layout/sidebar.screen.ts
  • apps/admin/src/routes.tsx

Comment thread apps/admin/src/layout/admin-layout.tsx Resolved
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
@9larsons
9larsons force-pushed the fix/settings-hide-sidebar-no-unmount branch from 11e45a3 to 8324695 Compare July 29, 2026 13:32
@9larsons 9larsons changed the title 🐛 Fixed settings routes leaving the outer admin sidebar visible 🐛 Fixed the admin sidebar flashing on settings screens Jul 29, 2026
@9larsons 9larsons changed the title 🐛 Fixed the admin sidebar flashing on settings screens 🐛 Fixed settings sidebar flash for editors/contributors Jul 29, 2026
@nx-cloud

nx-cloud Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit 8324695

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 9larsons left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@9larsons
9larsons enabled auto-merge (squash) July 29, 2026 13:36

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 11e45a3 and 8324695.

📒 Files selected for processing (5)
  • apps/admin/src/layout/app-sidebar/app-sidebar.tsx
  • apps/admin/src/layout/sidebar.acceptance.test.tsx
  • apps/admin/src/layout/sidebar.screen.ts
  • apps/admin/src/routes.tsx
  • packages/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

@9larsons
9larsons merged commit 316f62a into TryGhost:main Jul 29, 2026
42 checks passed
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.

2 participants