Skip to content

: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.

fix(today): keep /home on the briefing when the rail nav is on (#113177)

Adam Leith4a4d42fec95b
diff --git a/frontend/src/scenes/sceneLogic.test.tsx b/frontend/src/scenes/sceneLogic.test.tsx
index ed415aa2e9ce..f7341a324a08 100644
--- a/frontend/src/scenes/sceneLogic.test.tsx
+++ b/frontend/src/scenes/sceneLogic.test.tsx
@@ -6,6 +6,7 @@ import { expectLogic, partial, testUtilsContext, truth } from 'kea-test-utils'
import posthog from 'posthog-js'
import api from 'lib/api'
+import { FEATURE_FLAGS } from 'lib/constants'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { removeProjectIdIfPresent } from 'lib/utils/kea-router'
@@ -464,6 +465,16 @@ describe('sceneLogic', () => {
expect(removeProjectIdIfPresent(router.values.location.pathname)).toEqual(urls.dashboard(42))
})
+ it('stays on /home with the rail nav even when a homepage is configured', async () => {
+ featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.TODAY_RAIL_NAV], {
+ [FEATURE_FLAGS.TODAY_RAIL_NAV]: true,
+ })
+ logic.actions.setHomepage(dashboardHomepage)
+ router.actions.push(urls.projectHomepage())
+ await expectLogic(logic).delay(1)
+ expect(removeProjectIdIfPresent(router.values.location.pathname)).toEqual(urls.projectHomepage())
+ })
+
it('stays on the launchpad at /home when no homepage is configured', async () => {
logic.actions.setHomepage(null)
router.actions.push(urls.projectHomepage())
diff --git a/frontend/src/scenes/sceneLogic.tsx b/frontend/src/scenes/sceneLogic.tsx
index 9e89783d22bd..6752287fde5f 100644
--- a/frontend/src/scenes/sceneLogic.tsx
+++ b/frontend/src/scenes/sceneLogic.tsx
@@ -17,10 +17,11 @@ import posthog from 'posthog-js'
import { useEffect, useState } from 'react'
import api from 'lib/api'
-import { TeamMembershipLevel } from 'lib/constants'
+import { FEATURE_FLAGS, TeamMembershipLevel } from 'lib/constants'
import { trackFileSystemLogView } from 'lib/hooks/useFileSystemLogView'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { Spinner } from 'lib/lemon-ui/Spinner'
+import { FeatureFlagsSet, featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { getAppContext } from 'lib/utils/getAppContext'
import { isChunkLoadError } from 'lib/utils/isChunkLoadError'
import { addProjectIdIfMissing, getProjectIdentifierInPath, removeProjectIdIfPresent } from 'lib/utils/kea-router'
@@ -259,6 +260,7 @@ function withForwardedHashAndSearchParams(
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface sceneLogicValues {
billing: BillingType | null // billingLogic
+ featureFlags: FeatureFlagsSet // featureFlagLogic
organizationBeingDeleted: string | null // organizationLogic
activeExportedScene: SceneExport<SceneProps> | null
activeLoadedScene: LoadedScene | null
@@ -416,7 +418,14 @@ export const sceneLogic = kea<sceneLogicType>([
connect(() => ({
logic: [router, userLogic, preflightLogic, teamLogic],
actions: [inviteLogic, ['hideInviteModal']],
- values: [billingLogic, ['billing'], organizationLogic, ['organizationBeingDeleted']],
+ values: [
+ billingLogic,
+ ['billing'],
+ organizationLogic,
+ ['organizationBeingDeleted'],
+ featureFlagLogic,
+ ['featureFlags'],
+ ],
})),
afterMount(({ cache }) => {
cache.mountedSceneLogic = null as MountedSceneLogic | null
@@ -1111,7 +1120,9 @@ export const sceneLogic = kea<sceneLogicType>([
// already at it, which also guards against loops when the homepage is the launchpad itself.
const redirectToConfiguredHomepage = (searchParams: Params, hashParams: Params): boolean => {
const homepage = values.homepage
- if (!homepage) {
+ // The rail nav makes /home the Today briefing and has no control to change the homepage,
+ // so a homepage saved before the rail would hide Today with no way back.
+ if (!homepage || values.featureFlags[FEATURE_FLAGS.TODAY_RAIL_NAV]) {
return false
}
const targetPathname = homepageTargetPathname(homepage)