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(sidepanel): hide the Discussion tab on scenes that can't host it (#94789)

posthog[bot]44695ebd7e8a
diff --git a/frontend/src/layout/navigation-3000/sidepanel/sidePanelLogic.test.ts b/frontend/src/layout/navigation-3000/sidepanel/sidePanelLogic.test.ts
index 59a8b01031f9..2e9e9e8fc804 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/sidePanelLogic.test.ts
+++ b/frontend/src/layout/navigation-3000/sidepanel/sidePanelLogic.test.ts
@@ -30,6 +30,7 @@ const sceneImport = (): any => ({ scene: { component: () => null } })
const testScenes: Record<string, () => any> = {
[Scene.DataManagement]: sceneImport,
+ [Scene.EventDefinition]: sceneImport,
[Scene.Settings]: sceneImport,
}
@@ -61,6 +62,14 @@ describe('sidePanelLogic', () => {
await navigate(urls.eventDefinitions())
})
+ it('only offers the Discussion tab on scenes that have an activity scope', async () => {
+ await navigate(urls.eventDefinitions())
+ expect(logic.values.enabledTabs).not.toContain(SidePanelTab.Discussion)
+
+ await navigate(urls.eventDefinition('1'))
+ expect(logic.values.enabledTabs).toContain(SidePanelTab.Discussion)
+ })
+
it('closes a context-bound tab when navigating to a different scene', async () => {
sidePanelStateLogic.actions.openSidePanel(SidePanelTab.Activity)
await navigate(urls.settings('user'))
diff --git a/frontend/src/layout/navigation-3000/sidepanel/sidePanelLogic.tsx b/frontend/src/layout/navigation-3000/sidepanel/sidePanelLogic.tsx
index 2518a50c31a9..9cea1abec880 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/sidePanelLogic.tsx
+++ b/frontend/src/layout/navigation-3000/sidepanel/sidePanelLogic.tsx
@@ -176,10 +176,15 @@ export const sidePanelLogic = kea<sidePanelLogicType>([
tabs.push(SidePanelTab.Max)
tabs.push(SidePanelTab.Notebooks)
- if (sceneSidePanelContext?.activity_scope && hasAvailableFeature(AvailableFeature.AUDIT_LOGS)) {
- tabs.push(SidePanelTab.Activity)
+ // Activity entries and comments are both stored against the scene's activity scope. A
+ // scene that declares none has nothing to show, and the discussion panel can only
+ // render its "not supported here" state.
+ if (sceneSidePanelContext?.activity_scope) {
+ if (hasAvailableFeature(AvailableFeature.AUDIT_LOGS)) {
+ tabs.push(SidePanelTab.Activity)
+ }
+ tabs.push(SidePanelTab.Discussion)
}
- tabs.push(SidePanelTab.Discussion)
if (sceneSidePanelContext.access_control_resource && sceneSidePanelContext.access_control_resource_id) {
tabs.push(SidePanelTab.AccessControl)