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(taxonomic-filter): single-line rows in rebuild menu, move "sent as" to preview (#63446)

Paul D'Ambra57696b06d2b3
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 397fe9c12e1d..f75ff278ec6c 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -2137,9 +2137,9 @@ snapshots:
filters-taxonomic-filter-menu-rebuild--properties--light:
hash: v1.k794b7964.d34e4efbf39b777cea753e09d6b6676279568fc8149b0150d38212ecea25ebae.00tWwmV_ZtFEKmK0-hgMIyVtRyGl4_88ZF9_iz3_T-k
filters-taxonomic-filter-menu-rebuild--recents-bare-key-expansion--dark:
- hash: v1.k794b7964.d47b9ae5b4b05520a8b6725adfc829fc08da595b9a72b557e5d39a4ce5acea44.lP5Ievpe_FkO3iEUbgsHoWj5Qjm2s7LFqFVv0S7nJl8
+ hash: v1.k794b7964.cc3b845bfe2b965e59141f710893998621d01c063142723621448e35e09c8d7c.65PiOvdxhTsaujscK1Xe-MPtxHjqeaMhA7SCnWoZaO8
filters-taxonomic-filter-menu-rebuild--recents-bare-key-expansion--light:
- hash: v1.k794b7964.b9e5a695cce725c88d391872a8ddc237b163757f2f92e7ed959b81043a9e6309.N99hQro_0BlVsZU7N7c2psbbF88r0rWWO46aZ2fG18w
+ hash: v1.k794b7964.ac72ea7dcc07282f4ade675a6099524699367bdd14b0d64202fb77ca7375a95f.qnS6G_IMFEvW0ViNb2MQuv8Ytomdv_AiBBYEQ6sZl3A
filters-taxonomic-filter-menu-rebuild--series-plus-data-warehouse--dark:
hash: v1.k794b7964.5364889863d936006f0c97c11ae97ac04c301fcf51c664fb2e47be556f8b0314.DyFJNAuMFjmc4NK-8KbMb3CEQ3F4l9ZdaRi4lqkUsWc
filters-taxonomic-filter-menu-rebuild--series-plus-data-warehouse--light:
diff --git a/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.tsx b/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.tsx
index 28660096571a..2cf8e87b62c4 100644
--- a/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.tsx
+++ b/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.tsx
@@ -1133,25 +1133,26 @@ interface RowProps {
}
/**
- * Resolve a row's three normalized cells:
+ * Resolve a row's normalized cells:
* - name: human-friendly label (e.g. "Pageview", "/checkout")
- * - value: raw underlying value when distinct from the name
- * (e.g. "$pageview", "localhost:8010")
+ * - value: raw underlying value when distinct from the name (the full
+ * URL, or the raw `$key`). The preview pane is the primary home
+ * for this ("Sent as"), but the preview is hidden below `md`, so
+ * the row keeps a narrow-screen-only copy of it.
* - category: group name shown as an uppercase tag at the bottom
*
- * URLs split into path (name) + host (value); friendly definitions
- * surface the friendly label as the name and the raw `$key` as the
- * value; everything else uses the entry name as the name and omits
- * the value cell.
+ * URLs surface their path tail as the name; friendly definitions surface
+ * the friendly label; everything else uses the entry name and has no
+ * distinct raw value to show.
*/
function resolveRowCells(entry: MenuFilterEntry): { name: string; value?: string; category: string } {
if (entry.recentLabel) {
return { name: entry.recentLabel, category: entry.group.name }
}
const friendly = entry.friendlyLabel
- const url = parseUrl(entry.name)
- if (url) {
- return { name: url.pathTail, value: url.host, category: entry.group.name }
+ const pathTail = parseUrlPathTail(entry.name)
+ if (pathTail !== null) {
+ return { name: pathTail, value: entry.name, category: entry.group.name }
}
if (friendly && friendly.length > 0 && friendly !== entry.name) {
return { name: friendly, value: entry.name, category: entry.group.name }
@@ -1194,11 +1195,14 @@ function Row({ entry, showCategory, recency, opensSubmenu, selectedRowId, onSele
>
<div className="flex flex-col items-start gap-0 min-w-0 flex-1">
<span className="text-sm leading-tight truncate max-w-full">{name}</span>
-
- <span className="font-mono text-xs text-tertiary/50 leading-tight truncate max-w-full">
- {value || <span className="opacity-50">N/A</span>}
- </span>
- {showCategory && <MenuLabel className="text-tertiary/50 text-xxs p-0 mt-px">{category}</MenuLabel>}
+ {/* The preview pane (hidden below `md`) is the primary home for the
+ raw value, so only narrow screens keep it inline on the row. */}
+ {value && (
+ <span className="md:hidden font-mono text-xs text-tertiary/50 leading-tight truncate max-w-full">
+ {value}
+ </span>
+ )}
+ {showCategory && <MenuLabel className="text-tertiary/50 text-xxs p-0 mt-1">{category}</MenuLabel>}
</div>
{recency && (
<Badge variant="default" className="gap-1 shrink-0">
@@ -1260,16 +1264,15 @@ function Fetcher({
}
/** Skeleton placeholder shown in place of the result list while a remote
- * fetch is in flight and we have nothing to show yet. Matches the row
- * layout (two-line label + tag stub) so the popover height doesn't jump
- * when results arrive. */
+ * fetch is in flight and we have nothing to show yet. Matches the
+ * single-line row layout so the popover height doesn't jump when results
+ * arrive. */
function LoadingRows(): JSX.Element {
return (
<div className="flex flex-col gap-1 p-2" data-attr="menu-filter-loading">
{[0, 1, 2, 3, 4].map((i) => (
- <div key={i} className="flex flex-col gap-1 px-2 py-1">
+ <div key={i} className="px-2 py-1">
<Skeleton className="h-3.5 w-2/3 rounded" />
- <Skeleton className="h-3 w-1/3 rounded" />
</div>
))}
</div>
@@ -1277,18 +1280,17 @@ function LoadingRows(): JSX.Element {
}
/**
- * Parse a URL-shaped string into `{ host, pathTail }` for two-line row
- * rendering. Returns `null` for anything that isn't a `http(s)://` URL or
- * fails to parse — caller falls back to default rendering.
+ * Parse a URL-shaped string into its path tail (path + search + hash) for
+ * row rendering. Returns `null` for anything that isn't a `http(s)://` URL
+ * or fails to parse — caller falls back to default rendering.
*/
-function parseUrl(s: string): { host: string; pathTail: string } | null {
+function parseUrlPathTail(s: string): string | null {
if (typeof s !== 'string' || !/^https?:\/\//i.test(s)) {
return null
}
try {
const u = new URL(s)
- const tail = (u.pathname || '/') + u.search + u.hash
- return { host: u.host, pathTail: tail }
+ return (u.pathname || '/') + u.search + u.hash
} catch {
return null
}
diff --git a/frontend/src/lib/components/TaxonomicFilter/menu/PreviewPane.tsx b/frontend/src/lib/components/TaxonomicFilter/menu/PreviewPane.tsx
index 58e80473a0a0..20b4b162d7d8 100644
--- a/frontend/src/lib/components/TaxonomicFilter/menu/PreviewPane.tsx
+++ b/frontend/src/lib/components/TaxonomicFilter/menu/PreviewPane.tsx
@@ -79,13 +79,6 @@ function PreviewBody({ entry }: { entry: MenuFilterEntry }): JSX.Element | null
</div>
)}
- {details.rawName && details.rawName !== details.title && (
- <div className="flex flex-col gap-0.5 border-t pt-2">
- <div className="text-xxs uppercase tracking-wide text-secondary">Sent as</div>
- <code className="text-xs break-all font-mono">{details.rawName}</code>
- </div>
- )}
-
{isAction && <ActionMatchGroups item={entry.item} />}
</div>
</ScrollArea>
@@ -140,6 +133,12 @@ function PreviewHeader({ details, viewUrl, entry }: PreviewHeaderProps): JSX.Ele
<div className="flex flex-col gap-1">
<div className="text-xxs uppercase tracking-wide text-secondary">{details.groupLabel}</div>
<div className="text-base font-semibold leading-tight break-words">{details.title}</div>
+ {details.rawName && details.rawName !== details.title && (
+ <div className="flex items-baseline gap-1 text-xs text-secondary">
+ <span>Sent as</span>
+ <code className="break-all font-mono text-tertiary">{details.rawName}</code>
+ </div>
+ )}
<VerificationBadge entry={entry} className="mt-1 self-start" />
</div>
<Separator />