Skip to content

🐛 Fixed 404 when navigating between post stats and editor#26285

Merged
cmraible merged 1 commit intomainfrom
ONC-1421_fix-post-stats-breadcrumb
Feb 12, 2026
Merged

🐛 Fixed 404 when navigating between post stats and editor#26285
cmraible merged 1 commit intomainfrom
ONC-1421_fix-post-stats-breadcrumb

Conversation

@troyciesco
Copy link
Contributor

@troyciesco troyciesco commented Feb 5, 2026

Closes ONC-1421: 404 when navigating between post analytics & editor

Problem

  • Opening editor from analytics set a bad back path, so < Analytics could point to an invalid post URL and 404.

Solution

  • In lexical-editor.js, derive the previous analytics path from transition route info instead of guessing.
  • Handle both analytics families (posts-x, stats-x), including subroutes and query params.
  • Store the resolved path in controller.fromAnalytics for existing posts only.
  • Reset fromAnalytics on route reset to prevent stale breadcrumbs.
  • Add acceptance coverage in editor-test.js for:
    • post analytics root/subpage
    • stats root/subpage/query params
    • new post (no analytics breadcrumb)
    • default posts breadcrumb fallback

stat-edit-post-stat

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 5, 2026

Walkthrough

The pull request refactors analytics route handling in the Lexical Editor and extends the editor's acceptance tests. The route definition introduces helper utilities and constants to classify and reconstruct analytics routes from transitions, implementing a new buildAnalyticsSourcePath function for analytics path construction. The route service now includes router and ui service declarations. The acceptance tests are expanded to cover multiple analytics breadcrumb scenarios, including breadcrumbs to post analytics root, post analytics subpages, analytics root, and analytics subpages with query parameters.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main purpose of the PR—fixing a 404 error when navigating between post analytics and the editor—which aligns with the changes across both the route handler and test files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description check ✅ Passed The pull request description clearly explains the problem being fixed, the solution implemented, and the acceptance test coverage added.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ONC-1421_fix-post-stats-breadcrumb

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 and usage tips.

@troyciesco troyciesco force-pushed the ONC-1421_fix-post-stats-breadcrumb branch from b7f4b05 to 36c224e Compare February 12, 2026 15:13
@troyciesco troyciesco marked this pull request as ready for review February 12, 2026 16:37
@troyciesco troyciesco force-pushed the ONC-1421_fix-post-stats-breadcrumb branch from b6c04df to 392d0e6 Compare February 12, 2026 16:37
@troyciesco troyciesco requested review from 9larsons and cmraible and removed request for 9larsons February 12, 2026 17:24
@troyciesco troyciesco added the ok to merge for me You can merge this on my behalf if you want. label Feb 12, 2026
Copy link
Collaborator

@cmraible cmraible left a comment

Choose a reason for hiding this comment

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

LGTM!

@cmraible cmraible merged commit fc505e3 into main Feb 12, 2026
32 checks passed
@cmraible cmraible deleted the ONC-1421_fix-post-stats-breadcrumb branch February 12, 2026 19:53
betschki pushed a commit to magicpages/Ghost that referenced this pull request Feb 19, 2026
…6285)

Closes [ONC-1421: 404 when navigating between post analytics &
editor](https://linear.app/ghost/issue/ONC-1421/404-when-navigating-between-post-analytics-and-editor)

Problem
- Opening editor from analytics set a bad back path, so `< Analytics`
could point to an invalid post URL and 404.

Solution
- In `lexical-editor.js`, derive the previous analytics path from
transition route info instead of guessing.
- Handle both analytics families (`posts-x`, `stats-x`), including
subroutes and query params.
- Store the resolved path in `controller.fromAnalytics` for existing
posts only.
- Reset `fromAnalytics` on route reset to prevent stale breadcrumbs.
- Add acceptance coverage in `editor-test.js` for:
  - post analytics root/subpage
  - stats root/subpage/query params
  - new post (no analytics breadcrumb)
  - default posts breadcrumb fallback


![stat-edit-post-stat](https://github.com/user-attachments/assets/a79d3d81-271f-4d4b-aa74-833c9936feb2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok to merge for me You can merge this on my behalf if you want.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants