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.

feat(max): open a new chat when selecting the Chat nav tab (#60970)

Paul D'Ambra367b77777e45
diff --git a/frontend/src/layout/panel-layout/ai-first/Nav.tsx b/frontend/src/layout/panel-layout/ai-first/Nav.tsx
index 63cf05e7f2db..9442a1c97df3 100644
--- a/frontend/src/layout/panel-layout/ai-first/Nav.tsx
+++ b/frontend/src/layout/panel-layout/ai-first/Nav.tsx
@@ -1,6 +1,7 @@
import { Tabs } from '@base-ui/react/tabs'
import { cva } from 'cva'
import { useActions, useValues } from 'kea'
+import { router } from 'kea-router'
import posthog from 'posthog-js'
import { lazy, Suspense, useRef } from 'react'
@@ -18,6 +19,7 @@ import { Label } from 'lib/ui/Label/Label'
import { WrappingLoadingSkeleton } from 'lib/ui/WrappingLoadingSkeleton/WrappingLoadingSkeleton'
import { cn } from 'lib/utils/css-classes'
import { sceneLogic } from 'scenes/sceneLogic'
+import { urls } from 'scenes/urls'
import { NavExperimentTab, PanelLayoutNavIdentifier, panelLayoutLogic } from '~/layout/panel-layout/panelLayoutLogic'
@@ -173,10 +175,14 @@ export function Nav(): JSX.Element {
tooltipPlacement="right"
active={activePanelIdentifier === 'Chat'}
onClick={() => {
+ const isOpening = activePanelIdentifier !== 'Chat'
posthog.capture('nav chat panel toggled', {
- is_open: activePanelIdentifier !== 'Chat',
+ is_open: isOpening,
})
handlePanelTriggerClick('Chat')
+ if (isOpening) {
+ router.actions.push(urls.ai())
+ }
}}
>
<span
@@ -205,6 +211,9 @@ export function Nav(): JSX.Element {
onValueChange={(value) => {
posthog.capture('nav tab clicked', { tab: value })
setNavExperimentTab(value as NavExperimentTab)
+ if (value === 'chat') {
+ router.actions.push(urls.ai())
+ }
}}
orientation={isLayoutNavCollapsed ? 'vertical' : 'horizontal'}
>
diff --git a/frontend/src/layout/panel-layout/ai-first/tabs/NavTabChat.tsx b/frontend/src/layout/panel-layout/ai-first/tabs/NavTabChat.tsx
index 1b8ccfa81449..859ce7638a00 100644
--- a/frontend/src/layout/panel-layout/ai-first/tabs/NavTabChat.tsx
+++ b/frontend/src/layout/panel-layout/ai-first/tabs/NavTabChat.tsx
@@ -118,6 +118,7 @@ export function NavTabChat({
</label>
<Link
to={urls.ai()}
+ data-attr="nav-chat-new"
buttonProps={{ iconOnly: true, variant: 'outline', className: 'text-ai' }}
tooltip="New chat"
>
@@ -178,6 +179,7 @@ export function NavTabChat({
to={AiChatListItem.getHref(
conversation.id
)}
+ data-attr="nav-chat-history-conversation"
buttonProps={{
active:
conversation.id ===