🐛 Fixed 404 when navigating between post stats and editor#26285
🐛 Fixed 404 when navigating between post stats and editor#26285
Conversation
WalkthroughThe 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)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
b7f4b05 to
36c224e
Compare
b6c04df to
392d0e6
Compare
…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 
Closes ONC-1421: 404 when navigating between post analytics & editor
Problem
< Analyticscould point to an invalid post URL and 404.Solution
lexical-editor.js, derive the previous analytics path from transition route info instead of guessing.posts-x,stats-x), including subroutes and query params.controller.fromAnalyticsfor existing posts only.fromAnalyticson route reset to prevent stale breadcrumbs.editor-test.jsfor: