:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(navigation): redirect id-less project settings section links to settings (#129789)
Rafael Audibertab92dada0875
diff --git a/frontend/src/scenes/sceneLogic.test.tsx b/frontend/src/scenes/sceneLogic.test.tsxindex f2fc63d41260..c6be286a7d3b 100644--- a/frontend/src/scenes/sceneLogic.test.tsx+++ b/frontend/src/scenes/sceneLogic.test.tsx@@ -342,6 +342,9 @@ describe('sceneLogic', () => {['/organization/projects/new', urls.projectCreateFirst(), Scene.ProjectCreateFirst],['/organization/create', urls.organizationCreateFirst(), Scene.OrganizationCreateFirst],['/organization/new', urls.organizationCreateFirst(), Scene.OrganizationCreateFirst],+ ['/project/settings/environment-replay', urls.settings('environment-replay'), Scene.Settings],+ // Bookmarks of the doubled path an id-less settings link once turned into must reach settings too+ ['/project/123/project/settings/project-details', urls.settings('project-details'), Scene.Settings],])('sends the unrouted %s to %s instead of the 404 scene', async (path, expected, expectedScene) => {router.actions.push(path)await expectLogic(logic).delay(1)@@ -349,6 +352,13 @@ describe('sceneLogic', () => {expect(removeProjectIdIfPresent(router.values.location.pathname)).toEqual(expected)})+ it('keeps the setting anchor when redirecting an id-less settings section link', async () => {+ router.actions.push('/project/settings/environment-replay#replay-triggers')+ await expectLogic(logic).delay(1)+ expect(removeProjectIdIfPresent(router.values.location.pathname)).toEqual(urls.settings('environment-replay'))+ expect(router.values.location.hash).toEqual('#replay-triggers')+ })+// The redirect table is keyed on exact paths, so a later `/organization/*` prefix entry would// shadow the real scenes under it.it('keeps /organization/billing on its own scene route, not the organization redirect', async () => {diff --git a/frontend/src/scenes/scenes.ts b/frontend/src/scenes/scenes.tsindex 4b89e1d6c5b4..f209e0cd00c1 100644--- a/frontend/src/scenes/scenes.ts+++ b/frontend/src/scenes/scenes.ts@@ -18,6 +18,7 @@ import { EventsQuery } from '~/queries/schema/schema-general'import { ActivityScope, ActivityTab, InsightShortId, ReplayTabs } from '~/types'import { BillingSectionId } from './billing/types'+import { SettingSectionId } from './settings/types'export const emptySceneParams = { params: {}, searchParams: {}, hashParams: {} }@@ -743,6 +744,8 @@ export const redirects: Record<// There is no /project/new scene; send typed URLs and old bookmarks to the create-project flow'/project/new': urls.projectCreateFirst(),'/project/settings': urls.settings('project'),+ '/project/settings/:section': ({ section }, _searchParams, hashParams) =>+ combineUrl(urls.settings(section as SettingSectionId), {}, hashParams).url,// The quickstart landing page is gone; keep old bookmarks and pinned tabs out of a 404'/quickstart': urls.default(),'/recordings/file-playback': () => urls.replayFilePlayback(),