🐛 Fixed stale sidebar selections across Admin routes - #30334
Conversation
fixes https://linear.app/ghost/issue/DES-1491/posts-and-pages-selection-gets-stuck-in-nav-sidebar React-owned navigation uses pushState, which leaves Ember's last route active. Trust bridged route state only while an Ember fallback is rendered so the sidebar follows the router that owns the current screen.
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run @tryghost/admin:test:acceptance |
✅ Succeeded | 8m 7s | View ↗ |
nx run-many -t test:unit -p @tryghost/admin |
✅ Succeeded | 1m 52s | View ↗ |
nx run ghost-monorepo:lint:boundaries |
✅ Succeeded | 23s | View ↗ |
nx run-many -t lint -p @tryghost/admin,ghost-mo... |
✅ Succeeded | 1m 23s | View ↗ |
nx run @tryghost/admin:build |
✅ Succeeded | 23s | View ↗ |
nx run @tryghost/e2e:test:fixtures |
✅ Succeeded | <1s | 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-08-27 09:55:49 UTC
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: QUIET Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📜 Recent review details⏰ Context from checks skipped due to timeout. (9)
🧰 Additional context used📓 Path-based instructions (7)Review Admin UI for existing Shade reuse, correct component layer, semantic⚙️ CodeRabbit configuration file Files:
Review whether tests prove changed behaviour, meaningful error/edge paths, and⚙️ CodeRabbit configuration file Files:
Review lens: "where does this data become trusted?"⚙️ CodeRabbit configuration file Files:
Prioritise concrete correctness, security, data-integrity, compatibility,⚙️ CodeRabbit configuration file Files:
Type-safe boundaries: Fail only if the PR:📄 CodeRabbit inference engine (Custom checks) Files:
Build new features in React,📄 CodeRabbit inference engine (AGENTS.md) Files:
Always use `pnpm`, never npm or Yarn.📄 CodeRabbit inference engine (AGENTS.md) Files:
🔇 Additional comments (6)
WalkthroughThe change guards Ember route activity with Suggested reviewers: Merge Risk: ⚪ Minimal · up to This change corrects stale sidebar selection across Admin navigation paths and adds targeted regression coverage; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
Full details: Type-Safe BoundariesExplanation PASS. The PR does not introduce an unvalidated boundary read or a typing bypass. The new Full details: New Files Are TypescriptExplanation PASS. The pull request changes six pre-existing files. The parent revision contains every changed path, and the diff has no added, copied, or renamed paths. All changed files use .ts or .tsx extensions. Therefore, the PR does not add a disallowed JavaScript source file. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |

Why
Navigating from an Ember-owned screen such as Posts or Pages to a React-owned screen could leave the old sidebar item selected. React Router uses
pushStatefor React-owned routes, which intentionally preserves router history for navigation blockers but does not notify the Ember router. The Ember bridge therefore continued reporting its last route as active.Fixes DES-1491.
What changed
hashchangenavigation./posts/analytics/*, matching the screen breadcrumb and product hierarchy.Testing
pnpm test:unit src/ember-bridge/ember-bridge.test.tsx src/layout/app-sidebar/nav-custom-views.test.tsxpnpm test:acceptance src/layout/sidebar.acceptance.test.tsxpnpm test:acceptance src/posts/analytics/post-analytics.acceptance.test.tsxpnpm typecheckESLint on all changed files
I have read and followed the Contributor Guide
I have explained my change
I have written automated tests to prove my change works