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.

chore: my tickets ui update (#94110)

Alex V1094394ff9fd
diff --git a/products/conversations/frontend/components/Chat/MessageList.tsx b/products/conversations/frontend/components/Chat/MessageList.tsx
index ba360c1b7c77..85b33a607317 100644
--- a/products/conversations/frontend/components/Chat/MessageList.tsx
+++ b/products/conversations/frontend/components/Chat/MessageList.tsx
@@ -257,7 +257,7 @@ export function MessageList({
// hold: it takes the caller's className and the height bounds, and stays the flex child
// callers lay out against. Without that, a caller's spacing (e.g. `mb-3`) would land inside
// the wrapper and stop separating the thread from whatever follows it.
- <div className={`relative flex flex-col flex-1 ${className}`} style={{ minHeight, maxHeight }}>
+ <div className={`relative flex flex-col flex-1 min-h-0 ${className}`} style={{ minHeight, maxHeight }}>
<div
ref={containerRef}
onScroll={handleScroll}
diff --git a/products/conversations/frontend/components/SidePanel/Ticket.tsx b/products/conversations/frontend/components/SidePanel/Ticket.tsx
index ebaa3adf0301..9a9a088a2aaf 100644
--- a/products/conversations/frontend/components/SidePanel/Ticket.tsx
+++ b/products/conversations/frontend/components/SidePanel/Ticket.tsx
@@ -3,6 +3,8 @@ import { useActions, useValues } from 'kea'
import { IconArrowLeft } from '@posthog/icons'
import { LemonButton, LemonDivider, LemonTag } from '@posthog/lemon-ui'
+import { cn } from 'lib/utils/css-classes'
+
import { MessageInput } from '../Chat/MessageInput'
import { MessageList } from '../Chat/MessageList'
import { sidepanelTicketsLogic } from './sidepanelTicketsLogic'
@@ -12,6 +14,10 @@ interface TicketProps {
showBackButton?: boolean
/** Lets master-detail layouts show the back button only at widths where the panes stack */
backButtonClassName?: string
+ /** Fill a bounded parent (the full-screen scene pane). The side panel must not opt in: its
+ * parent height is auto, and overflow-hidden plus a 400px message cap would leave an empty
+ * card below the composer. */
+ fillParent?: boolean
messagesMinHeight?: string
messagesMaxHeight?: string
}
@@ -19,15 +25,21 @@ interface TicketProps {
export function Ticket({
showBackButton = true,
backButtonClassName,
- messagesMinHeight = '300px',
- messagesMaxHeight = '400px',
+ fillParent = false,
+ messagesMinHeight = fillParent ? '0' : '300px',
+ messagesMaxHeight = fillParent ? 'none' : '400px',
}: TicketProps): JSX.Element {
const { messages, messagesLoading, messageSending, currentTicket } = useValues(sidepanelTicketsLogic)
const { sendMessage, setView } = useActions(sidepanelTicketsLogic)
return (
- <div className="flex flex-col h-full bg-surface-primary border rounded-lg p-2">
- <div className="flex items-center gap-2">
+ <div
+ className={cn(
+ 'flex flex-col h-full bg-surface-primary border rounded-lg p-2',
+ fillParent && 'min-h-0 overflow-hidden'
+ )}
+ >
+ <div className="flex items-center gap-2 shrink-0">
{showBackButton && (
<LemonButton
icon={<IconArrowLeft />}
@@ -62,7 +74,7 @@ export function Ticket({
className="mb-3"
isCustomerView
/>
- <div className="border-t pt-3">
+ <div className="border-t pt-3 shrink-0">
<MessageInput
onSendMessage={(content, _richContent, _isPrivate, onSuccess) => sendMessage(content, onSuccess)}
messageSending={messageSending}
diff --git a/products/conversations/frontend/components/SidePanel/TicketsList.tsx b/products/conversations/frontend/components/SidePanel/TicketsList.tsx
index 696224e5af88..15e5b37d5e46 100644
--- a/products/conversations/frontend/components/SidePanel/TicketsList.tsx
+++ b/products/conversations/frontend/components/SidePanel/TicketsList.tsx
@@ -2,13 +2,12 @@ import { useActions, useValues } from 'kea'
import posthog from 'posthog-js'
import { IconChevronRight } from '@posthog/icons'
-import { LemonBadge, LemonButton, LemonTag, Spinner } from '@posthog/lemon-ui'
-import { Link } from '@posthog/lemon-ui'
+import { LemonBadge, LemonButton, LemonSelect, LemonTag, Link, Spinner } from '@posthog/lemon-ui'
import { TZLabel } from 'lib/components/TZLabel'
import { stripMarkdown } from 'lib/utils/markdown'
-import type { ConversationTicket } from '../../types'
+import { statusOptions, type ConversationTicket } from '../../types'
import { sidepanelTicketsLogic } from './sidepanelTicketsLogic'
interface TicketsListProps {
@@ -17,8 +16,8 @@ interface TicketsListProps {
}
export function TicketsList({ selectedTicketId = null }: TicketsListProps): JSX.Element {
- const { tickets, ticketsLoading, canCreateTicket } = useValues(sidepanelTicketsLogic)
- const { setCurrentTicket, setView } = useActions(sidepanelTicketsLogic)
+ const { tickets, filteredTickets, ticketsLoading, canCreateTicket, statusFilter } = useValues(sidepanelTicketsLogic)
+ const { setCurrentTicket, setView, setStatusFilter } = useActions(sidepanelTicketsLogic)
const hasIdentityMode = !!window.JS_POSTHOG_IDENTITY_DISTINCT_ID
@@ -30,7 +29,9 @@ export function TicketsList({ selectedTicketId = null }: TicketsListProps): JSX.
)
}
- if (ticketsLoading) {
+ // Polls, tab-focus, and scene remounts all reuse loadTickets. A spinner here once
+ // tickets exist would hide the list on every interval.
+ if (ticketsLoading && tickets.length === 0) {
return (
<div className="flex items-center justify-center h-40">
<Spinner />
@@ -39,12 +40,13 @@ export function TicketsList({ selectedTicketId = null }: TicketsListProps): JSX.
}
return (
- <div className="flex flex-col gap-2">
+ <div className="flex flex-col gap-2 h-full min-h-0">
{canCreateTicket && (
<LemonButton
type="primary"
fullWidth
center
+ className="shrink-0"
onClick={() => setView('new')}
data-attr="sidebar-create-new-ticket"
>
@@ -52,7 +54,7 @@ export function TicketsList({ selectedTicketId = null }: TicketsListProps): JSX.
</LemonButton>
)}
{!hasIdentityMode && (
- <p className="text-center text-xs text-muted-alt m-0">
+ <p className="text-center text-xs text-muted-alt m-0 shrink-0">
Switched browsers?{' '}
<Link
className="cursor-pointer"
@@ -63,66 +65,87 @@ export function TicketsList({ selectedTicketId = null }: TicketsListProps): JSX.
</Link>
</p>
)}
- {tickets.length === 0 ? (
- <div className="text-center text-muted-alt py-8">
- <p>No tickets yet.</p>
- {canCreateTicket && (
- <p className="text-sm">Create a new ticket to get help from our support engineers.</p>
- )}
- </div>
- ) : (
- <div className="flex flex-col gap-1 mt-2">
- {tickets.map((ticket: ConversationTicket) => (
- <div
- key={ticket.id}
- className={`flex items-center justify-between p-3 rounded border cursor-pointer hover:bg-surface-light transition-colors ${
- (ticket.unread_count ?? 0) > 0 ? 'bg-primary-alt-highlight' : 'bg-surface-primary'
- } ${ticket.id === selectedTicketId ? 'border-accent' : ''}`}
- onClick={() => {
- setCurrentTicket(ticket)
- }}
- >
- <div className="flex-1 min-w-0">
- <div className="flex items-center gap-2 mb-1">
- {ticket.ticket_number && (
- <span className="text-xs font-mono text-muted-alt">
- #{ticket.ticket_number}
- </span>
- )}
- <LemonTag
- type={
- ticket.status === 'resolved'
- ? 'success'
- : ticket.status === 'new'
- ? 'primary'
- : 'default'
- }
- size="small"
- >
- {ticket.status === 'on_hold' ? 'On hold' : ticket.status}
- </LemonTag>
- {(ticket.unread_count ?? 0) > 0 && (
- <LemonBadge.Number
- count={ticket.unread_count ?? 0}
+ {tickets.length > 0 && (
+ <LemonSelect
+ size="small"
+ fullWidth
+ value={statusFilter}
+ onChange={(status) => {
+ if (status) {
+ setStatusFilter(status)
+ }
+ }}
+ options={statusOptions}
+ data-attr="sidebar-ticket-status-filter"
+ className="shrink-0"
+ />
+ )}
+ <div className="flex-1 min-h-0 overflow-y-auto">
+ {tickets.length === 0 ? (
+ <div className="text-center text-muted-alt py-8">
+ <p>No tickets yet.</p>
+ {canCreateTicket && (
+ <p className="text-sm">Create a new ticket to get help from our support engineers.</p>
+ )}
+ </div>
+ ) : filteredTickets.length === 0 ? (
+ <div className="text-center text-muted-alt py-8">
+ <p>No tickets with this status.</p>
+ </div>
+ ) : (
+ <div className="flex flex-col gap-1">
+ {filteredTickets.map((ticket: ConversationTicket) => (
+ <div
+ key={ticket.id}
+ className={`flex items-center justify-between p-3 rounded border cursor-pointer hover:bg-surface-light transition-colors ${
+ (ticket.unread_count ?? 0) > 0 ? 'bg-primary-alt-highlight' : 'bg-surface-primary'
+ } ${ticket.id === selectedTicketId ? 'border-accent' : ''}`}
+ onClick={() => {
+ setCurrentTicket(ticket)
+ }}
+ >
+ <div className="flex-1 min-w-0">
+ <div className="flex items-center gap-2 mb-1">
+ {ticket.ticket_number && (
+ <span className="text-xs font-mono text-muted-alt">
+ #{ticket.ticket_number}
+ </span>
+ )}
+ <LemonTag
+ type={
+ ticket.status === 'resolved'
+ ? 'success'
+ : ticket.status === 'new'
+ ? 'primary'
+ : 'default'
+ }
size="small"
- status="primary"
- />
+ >
+ {ticket.status === 'on_hold' ? 'On hold' : ticket.status}
+ </LemonTag>
+ {(ticket.unread_count ?? 0) > 0 && (
+ <LemonBadge.Number
+ count={ticket.unread_count ?? 0}
+ size="small"
+ status="primary"
+ />
+ )}
+ </div>
+ {ticket.last_message && (
+ <p className="text-sm text-primary truncate m-0">
+ {stripMarkdown(ticket.last_message)}
+ </p>
)}
- </div>
- {ticket.last_message && (
- <p className="text-sm text-primary truncate m-0">
- {stripMarkdown(ticket.last_message)}
+ <p className="text-xs text-muted-alt m-0 mt-1">
+ <TZLabel time={ticket.created_at} />
</p>
- )}
- <p className="text-xs text-muted-alt m-0 mt-1">
- <TZLabel time={ticket.created_at} />
- </p>
+ </div>
+ <IconChevronRight className="text-muted-alt" />
</div>
- <IconChevronRight className="text-muted-alt" />
- </div>
- ))}
- </div>
- )}
+ ))}
+ </div>
+ )}
+ </div>
</div>
)
}
diff --git a/products/conversations/frontend/components/SidePanel/sidepanelTicketsLogic.test.ts b/products/conversations/frontend/components/SidePanel/sidepanelTicketsLogic.test.ts
index 9ebc1737086e..c54ac9eebc09 100644
--- a/products/conversations/frontend/components/SidePanel/sidepanelTicketsLogic.test.ts
+++ b/products/conversations/frontend/components/SidePanel/sidepanelTicketsLogic.test.ts
@@ -507,4 +507,84 @@ describe('sidepanelTicketsLogic', () => {
message_preview: 'here is the error I get',
})
})
+
+ // ticketsLoading drives a full-list spinner. Polls reuse loadTickets, so only the first
+ // successful fetch may raise it, including a 0-ticket result that would otherwise flash
+ // the spinner over the empty state on every refresh.
+ it('raises ticketsLoading only until the first successful fetch', async () => {
+ let resolveTickets!: (value: { results: ConversationTicket[] }) => void
+ ;(posthog as any).conversations.getTickets = jest.fn().mockReturnValue(
+ new Promise((resolve) => {
+ resolveTickets = resolve
+ })
+ )
+
+ logic = sidepanelTicketsLogic.build()
+ logic.mount()
+ expect(logic.values.ticketsLoading).toBe(true)
+
+ resolveTickets({ results: [] })
+ await expectLogic(logic).toFinishAllListeners()
+ expect(logic.values.ticketsLoading).toBe(false)
+
+ ;(posthog as any).conversations.getTickets = jest.fn().mockReturnValue(
+ new Promise((resolve) => {
+ resolveTickets = resolve
+ })
+ )
+ logic.actions.loadTickets()
+ expect(logic.values.ticketsLoading).toBe(false)
+
+ resolveTickets({ results: [] })
+ await expectLogic(logic).toFinishAllListeners()
+ expect(logic.values.ticketsLoading).toBe(false)
+ })
+
+ it('does not raise ticketsLoading when tickets are already loaded', async () => {
+ logic = sidepanelTicketsLogic.build()
+ logic.mount()
+ await expectLogic(logic).toFinishAllListeners()
+
+ const ticket = {
+ id: 't1',
+ status: 'open',
+ message_count: 1,
+ created_at: '2026-07-13T00:00:00Z',
+ } as ConversationTicket
+ logic.actions.setTickets([ticket])
+
+ let resolveTickets!: (value: { results: ConversationTicket[] }) => void
+ ;(posthog as any).conversations.getTickets = jest.fn().mockReturnValue(
+ new Promise((resolve) => {
+ resolveTickets = resolve
+ })
+ )
+
+ logic.actions.loadTickets()
+ expect(logic.values.ticketsLoading).toBe(false)
+
+ resolveTickets({ results: [ticket] })
+ await expectLogic(logic).toFinishAllListeners()
+ expect(logic.values.ticketsLoading).toBe(false)
+ })
+
+ // TicketsList renders filteredTickets, so a broken selector would show the wrong chats
+ // (or none) once someone picks a status.
+ it.each([
+ ['all', ['t-open', 't-resolved']],
+ ['open', ['t-open']],
+ ['resolved', ['t-resolved']],
+ ] as const)('filters the ticket list to status %s', async (status, expectedIds) => {
+ logic = sidepanelTicketsLogic.build()
+ logic.mount()
+ await expectLogic(logic).toFinishAllListeners()
+
+ logic.actions.setTickets([
+ { id: 't-open', status: 'open', message_count: 1, created_at: '2026-07-13T00:00:00Z' },
+ { id: 't-resolved', status: 'resolved', message_count: 1, created_at: '2026-07-14T00:00:00Z' },
+ ] as ConversationTicket[])
+ logic.actions.setStatusFilter(status)
+
+ expect(logic.values.filteredTickets.map((ticket) => ticket.id)).toEqual(expectedIds)
+ })
})
diff --git a/products/conversations/frontend/components/SidePanel/sidepanelTicketsLogic.ts b/products/conversations/frontend/components/SidePanel/sidepanelTicketsLogic.ts
index a26879d0c915..05c90b8e5b0b 100644
--- a/products/conversations/frontend/components/SidePanel/sidepanelTicketsLogic.ts
+++ b/products/conversations/frontend/components/SidePanel/sidepanelTicketsLogic.ts
@@ -41,6 +41,7 @@ import type {
ConversationTicket,
RestoreFlowState,
SidePanelViewState,
+ TicketStatus,
} from '../../types'
// Poll cadence scales with how actively the user is looking at support, so an open thread stays
@@ -99,6 +100,7 @@ export interface sidepanelTicketsLogicValues {
supportResponseTime: string | null // supportLogic
canCreateTicket: boolean
currentTicket: ConversationTicket | null
+ filteredTickets: ConversationTicket[]
hasMoreMessages: boolean
hasSupportExemption: boolean
isBillingResolved: boolean
@@ -110,6 +112,7 @@ export interface sidepanelTicketsLogicValues {
pendingTicketId: string | null
restoreError: string | null
restoreState: RestoreFlowState
+ statusFilter: TicketStatus | 'all'
tickets: ConversationTicket[]
ticketsLoading: boolean
totalUnreadCount: number
@@ -197,6 +200,9 @@ export interface sidepanelTicketsLogicActions {
setRestoreState: (state: RestoreFlowState) => {
state: RestoreFlowState
}
+ setStatusFilter: (status: TicketStatus | 'all') => {
+ status: TicketStatus | 'all'
+ }
setTickets: (tickets: ConversationTicket[]) => {
tickets: ConversationTicket[]
}
@@ -221,6 +227,7 @@ export interface sidepanelTicketsLogicActions {
export interface sidepanelTicketsLogicMeta {
__keaTypeGenInternalSelectorTypes: {
totalUnreadCount: (tickets: ConversationTicket[]) => number
+ filteredTickets: (tickets: ConversationTicket[], statusFilter: TicketStatus | 'all') => ConversationTicket[]
canCreateTicket: (
billing: BillingType | null,
isCurrentOrganizationNew: boolean,
@@ -294,6 +301,7 @@ export const sidepanelTicketsLogic = kea<sidepanelTicketsLogicType>([
restoreFromUrlToken: (token: string) => ({ token }),
setRestoreState: (state: RestoreFlowState) => ({ state }),
setRestoreError: (error: string | null) => ({ error }),
+ setStatusFilter: (status: TicketStatus | 'all') => ({ status }),
}),
reducers({
view: [
@@ -382,6 +390,12 @@ export const sidepanelTicketsLogic = kea<sidepanelTicketsLogicType>([
setRestoreState: () => null,
},
],
+ statusFilter: [
+ 'all' as TicketStatus | 'all',
+ {
+ setStatusFilter: (_, { status }) => status,
+ },
+ ],
// Held for the life of the open panel rather than read off the support request, which resets
// the moment the intent is consumed — a plan that can't open tickets would otherwise lose the
// exemption mid-compose, and with it the composer it was just granted
@@ -398,6 +412,11 @@ export const sidepanelTicketsLogic = kea<sidepanelTicketsLogicType>([
(s) => [s.tickets],
(tickets: ConversationTicket[]) => tickets.reduce((sum, t) => sum + (t.unread_count ?? 0), 0),
],
+ filteredTickets: [
+ (s) => [s.tickets, s.statusFilter],
+ (tickets: ConversationTicket[], statusFilter: TicketStatus | 'all'): ConversationTicket[] =>
+ statusFilter === 'all' ? tickets : tickets.filter((t) => t.status === statusFilter),
+ ],
// Opening a ticket is the paid part of support. Reading and replying to tickets already in
// the account isn't — free plans can end up with tickets via billing questions or PostHog AI
// bug reports, and abandoning those threads helps nobody.
@@ -519,10 +538,15 @@ export const sidepanelTicketsLogic = kea<sidepanelTicketsLogicType>([
return
}
cache.conversationsRetries = 0
- actions.setTicketsLoading(true)
+ // Polls, tab-focus, and scene remounts reuse loadTickets. The flag drives a full-list
+ // spinner, so it is only raised until the first successful fetch.
+ if (!cache.ticketsFetched) {
+ actions.setTicketsLoading(true)
+ }
try {
const response = await posthog.conversations.getTickets({ limit: 50 })
if (response) {
+ cache.ticketsFetched = true
actions.setTickets(response.results as ConversationTicket[])
// With no tickets there's nothing to poll for; creating one re-runs loadTickets
// and restarts polling. Otherwise (re)schedule at the cadence startPolling picks.
diff --git a/products/conversations/frontend/scenes/myTickets/MyTicketsScene.tsx b/products/conversations/frontend/scenes/myTickets/MyTicketsScene.tsx
index b3e4cdb3dfa9..49a9263926e2 100644
--- a/products/conversations/frontend/scenes/myTickets/MyTicketsScene.tsx
+++ b/products/conversations/frontend/scenes/myTickets/MyTicketsScene.tsx
@@ -23,10 +23,6 @@ export const scene: SceneExport = {
logic: myTicketsSceneLogic,
}
-// Sized against the viewport so the thread fills the page without the scene itself scrolling
-const PANE_MIN_HEIGHT = 'min(400px, calc(100svh - 16rem))'
-const PANE_MAX_HEIGHT = 'calc(100svh - 16rem)'
-
export function MyTicketsScene(): JSX.Element {
const { view, currentTicket, newTicketDraftRevision, isBillingResolved } = useValues(sidepanelTicketsLogic)
const { preflight } = useValues(preflightLogic)
@@ -81,31 +77,37 @@ export function MyTicketsScene(): JSX.Element {
} else if (view === 'ticket' && currentTicket) {
pane = (
<Ticket
- backButtonClassName="lg:hidden"
- messagesMinHeight={PANE_MIN_HEIGHT}
- messagesMaxHeight={PANE_MAX_HEIGHT}
+ fillParent
+ backButtonClassName="@min-[48rem]/main-content:hidden"
+ messagesMinHeight="300px"
+ messagesMaxHeight="none"
/>
)
} else {
pane = (
- <div className="flex items-center justify-center border border-dashed rounded-lg text-muted-alt min-h-[min(400px,calc(100svh-16rem))]">
+ <div className="flex items-center justify-center border border-dashed rounded-lg text-muted-alt h-full min-h-80">
Select a ticket to view the conversation
</div>
)
}
return (
- <SceneContent>
+ <SceneContent className="flex-1 min-h-0 pb-4">
<SceneTitleSection
name="Your tickets"
description="Support conversations with the PostHog team"
resourceType={{ type: 'conversation' }}
/>
- <div className="flex flex-col lg:flex-row items-start gap-4">
- <div className="w-full lg:w-96 shrink-0 overflow-y-auto max-h-[calc(100svh-16rem)]">
+ {/* Overflow clipping is only safe in the side-by-side row, where the list has a bounded
+ height and its inner scroller can run. Stacked, the list is content-sized; clipping
+ here would hide tickets and leave the thread with no height. */}
+ <div className="flex flex-col gap-4 @min-[48rem]/main-content:flex-row @min-[48rem]/main-content:flex-1 @min-[48rem]/main-content:min-h-0 @min-[48rem]/main-content:overflow-hidden">
+ <div className="w-full @min-[48rem]/main-content:w-96 @min-[48rem]/main-content:shrink-0 @min-[48rem]/main-content:min-h-0 @min-[48rem]/main-content:h-full @min-[48rem]/main-content:overflow-hidden">
<TicketsList selectedTicketId={view === 'ticket' ? (currentTicket?.id ?? null) : null} />
</div>
- <div className="flex-1 min-w-0 w-full">{pane}</div>
+ <div className="w-full min-w-0 min-h-80 @min-[48rem]/main-content:flex-1 @min-[48rem]/main-content:min-h-0 @min-[48rem]/main-content:flex @min-[48rem]/main-content:flex-col">
+ {pane}
+ </div>
</div>
</SceneContent>
)