diff --git a/frontend/__snapshots__/scenes-app-sidepanels--side-panel-docs--dark.png b/frontend/__snapshots__/scenes-app-sidepanels--side-panel-docs--dark.png index 17cbc47a38452..a3e04b0c7f7dd 100644 Binary files a/frontend/__snapshots__/scenes-app-sidepanels--side-panel-docs--dark.png and b/frontend/__snapshots__/scenes-app-sidepanels--side-panel-docs--dark.png differ diff --git a/frontend/__snapshots__/scenes-app-sidepanels--side-panel-docs--light.png b/frontend/__snapshots__/scenes-app-sidepanels--side-panel-docs--light.png index 157ae9ad6515d..85b6a5d19efbb 100644 Binary files a/frontend/__snapshots__/scenes-app-sidepanels--side-panel-docs--light.png and b/frontend/__snapshots__/scenes-app-sidepanels--side-panel-docs--light.png differ diff --git a/frontend/src/scenes/PreflightCheck/preflightLogic.tsx b/frontend/src/scenes/PreflightCheck/preflightLogic.tsx index 0fd08035c75fc..f55a8b6c97c44 100644 --- a/frontend/src/scenes/PreflightCheck/preflightLogic.tsx +++ b/frontend/src/scenes/PreflightCheck/preflightLogic.tsx @@ -273,6 +273,12 @@ export const preflightLogic = kea([ return preflight?.is_debug }, ], + disableNavigationHooks: [ + (s) => [s.preflight], + (preflight): boolean | undefined => { + return preflight?.dev_disable_navigation_hooks + }, + ], }), listeners(({ values, actions }) => ({ handlePreflightFinished: () => { diff --git a/frontend/src/scenes/insights/insightSceneLogic.tsx b/frontend/src/scenes/insights/insightSceneLogic.tsx index 75e99677715a4..8ecaf9f4de564 100644 --- a/frontend/src/scenes/insights/insightSceneLogic.tsx +++ b/frontend/src/scenes/insights/insightSceneLogic.tsx @@ -29,7 +29,7 @@ export const insightSceneLogic = kea([ path(['scenes', 'insights', 'insightSceneLogic']), connect(() => ({ logic: [eventUsageLogic], - values: [teamLogic, ['currentTeam'], sceneLogic, ['activeScene'], preflightLogic, ['isDev']], + values: [teamLogic, ['currentTeam'], sceneLogic, ['activeScene'], preflightLogic, ['disableNavigationHooks']], })), actions({ setInsightId: (insightId: InsightShortId) => ({ insightId }), @@ -322,8 +322,7 @@ export const insightSceneLogic = kea([ return false } - if (values.isDev) { - // TRICKY: We disable beforeUnload handling in dev, but ONLY for insights + if (values.disableNavigationHooks) { return false } diff --git a/frontend/src/types.ts b/frontend/src/types.ts index 964667b36ec58..125cfbce0510b 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -2965,6 +2965,7 @@ export interface PreflightStatus { buffer_conversion_seconds?: number object_storage: boolean public_egress_ip_addresses?: string[] + dev_disable_navigation_hooks?: boolean } export enum ItemMode { // todo: consolidate this and dashboardmode diff --git a/posthog/settings/web.py b/posthog/settings/web.py index 0a88799f33375..01b2211b1e6e1 100644 --- a/posthog/settings/web.py +++ b/posthog/settings/web.py @@ -380,3 +380,6 @@ def add_recorder_js_headers(headers, path, url): PROXY_BASE_CNAME = get_from_env("PROXY_BASE_CNAME", "") LOGO_DEV_TOKEN = get_from_env("LOGO_DEV_TOKEN", "") + +# disables frontend side navigation hooks to make hot-reload work seamlessly +DEV_DISABLE_NAVIGATION_HOOKS = get_from_env("DEV_DISABLE_NAVIGATION_HOOKS", False, type_cast=bool) diff --git a/posthog/views.py b/posthog/views.py index 76a823762b656..139da5bbea4f8 100644 --- a/posthog/views.py +++ b/posthog/views.py @@ -130,6 +130,9 @@ def preflight_check(request: HttpRequest) -> JsonResponse: if settings.DEBUG or settings.E2E_TESTING: response["is_debug"] = True + if settings.DEV_DISABLE_NAVIGATION_HOOKS: + response["dev_disable_navigation_hooks"] = True + if request.user.is_authenticated: response = { **response,