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(dashboards): session replay list widget and run_widgets limits (4/5) (#61751)

Matt Pua486f4d9603e6
diff --git a/.agents/skills/dashboard-widgets/references/layout-and-ux.md b/.agents/skills/dashboard-widgets/references/layout-and-ux.md
index 614cb9d5b390..52419e00f8ba 100644
--- a/.agents/skills/dashboard-widgets/references/layout-and-ux.md
+++ b/.agents/skills/dashboard-widgets/references/layout-and-ux.md
@@ -30,7 +30,7 @@ Set mins on the catalog entry only:
```typescript
// products/dashboards/frontend/widget_types/catalog.ts
-defaultLayout: { w: 6, h: 5, minW: 6, minH: 3 },
+defaultLayout: { w: 6, h: 5, minW: 3, minH: 3 },
```
| Field | Meaning |
@@ -50,7 +50,7 @@ defaultLayout: { w: 6, h: 5, minW: 6, minH: 3 },
| Constant | Value | Used when |
| ----------------------------- | ----- | ---------------------------------- |
-| `MIN_WIDGET_TILE_WIDTH_COLS` | 6 | Widget tile, catalog has no `minW` |
+| `MIN_WIDGET_TILE_WIDTH_COLS` | 3 | Widget tile, catalog has no `minW` |
| `MIN_WIDGET_TILE_HEIGHT_ROWS` | 4 | Widget tile, catalog has no `minH` |
| `MIN_TILE_HEIGHT_ROWS` | 2 | Insight tiles |
| `MIN_TEXT_TILE_HEIGHT_ROWS` | 1 | Text tiles |
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index d4cb9bd1d2eb..2cf83cf69197 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -1487,7 +1487,7 @@ snapshots:
dashboards-dashboard-widgets-overview--all-widget-types--dark:
hash: v1.k794b7964.6291f679616a912c2094e61d9e316d0705de8d9ae9223645cf41c459813354a4.fi2ADQ5y2hp5PrFJDVTL7P5r70H1Jy-36_e36EnYLE4
dashboards-dashboard-widgets-overview--all-widget-types--light:
- hash: v1.k794b7964.f8aa40d34886eab07d4309b83a42884245600ed9e35e9d9c2ba4f02f9c26da5b.fPTXObVz6IIyi09DiM9bynuxz6Dp91o1V_L4tC00VLw
+ hash: v1.k794b7964.1246a7bb0cf146a752a8c0f60ae8956222c0597c6b1f4d4d539b8b52e383fa13.z-DPN-xOkprfzRYWGkMzo8kGJTaHacQemvvLsho_tT4
dashboards-dashboard-widgets-widget-types-error-tracking-top-issues--default--dark:
hash: v1.k794b7964.1dca7d9829d631b8cd013d634f56c46488883b12ad5419d9f108f3f434d9c76b.2hKo2ObzPmyWmBD-6e3bFD8qJGQj_yKSEzGZc5hR4nE
dashboards-dashboard-widgets-widget-types-error-tracking-top-issues--default--light:
@@ -1516,22 +1516,26 @@ snapshots:
hash: v1.k794b7964.aec959497f395afca3960d2ebf4e82e9f6fe72334c825533722a7a369313efe2.09zUcQOLWCd7nAXBzkR6D0wEFuq4DsXAOYjdFvPJqPQ
dashboards-dashboard-widgets-widget-types-error-tracking-top-issues-widget-settings--default--light:
hash: v1.k794b7964.af604b406115bf252f107bd8599029b5e34b473e76cac0c368f12228895186ed.xLjKRF0exewyVhp-Zz52PwMmAJbqO6trsSNRtXbzIEY
+ dashboards-dashboard-widgets-widget-types-session-replay-recent-recordings--default--dark:
+ hash: v1.k794b7964.f1698058cec0af37a2fb4d427bc7b15083559fa9227e94e49e9593625481c9b4.j-4sLHULNBCXVrl8NcFjxdVp2-ZEhpoDz4VLre5w_34
+ dashboards-dashboard-widgets-widget-types-session-replay-recent-recordings--default--light:
+ hash: v1.k794b7964.81a1378fee1d06b6ab6694275f3445452a7d8b5ce58fc32a983aa7f47ce8a39f.Y6bQeZ31a5YYx9Aqf843Qox9J-TEx7r8d25rOlSzWAU
dashboards-dashboard-widgets-widget-types-session-replay-recent-recordings--empty--dark:
- hash: v1.k794b7964.0889c484f8f0d9ee048083e9fa2fc738841b146b21b8aa3a94a4c1bc872131b2.IMQafZvuzRCegEV39NlJB0NswElKBpcQBYAomG2lg70
+ hash: v1.k794b7964.be226977d5f72fdb0301d4e864449748e415b98c8ca5c0c13c7875c753e6d0a8.lNuA0SSyrtLdg4y9GDpAtvGiua2_SBEn_euJuQQpnSs
dashboards-dashboard-widgets-widget-types-session-replay-recent-recordings--empty--light:
- hash: v1.k794b7964.63e0696f90177908357ba0981fef6d29deeb5151fba8f093557bf5f7cdf701ac.wBAQlaLkNJ7fm5hMJxB54hIM3m0iDefdOvPEzsmVroU
+ hash: v1.k794b7964.8594cb806e039b6acc39aa154cc9d615cf617ccc94a233dc994d2d6458660524.sKo_0DMoN3WolbzfcIrukqUvlRMTmvv3arMQXGhDJFo
dashboards-dashboard-widgets-widget-types-session-replay-recent-recordings--loading--dark:
- hash: v1.k794b7964.fbbec720a0aea882f3b3ebf771b37ddb27d82b3ac726b45deb1a69e3f066d01f.ckn1xNOukgjUkCXmWqIO5tRMsJjay4599TUJaFO_kNw
+ hash: v1.k794b7964.8c716c7fa337951ad08fef65d72c00bb666cb084b29f985198b9cb524732f099.KK_xA5RwbUvuQeFem6S-3nUPFw-CZhUqskMJ44PJlas
dashboards-dashboard-widgets-widget-types-session-replay-recent-recordings--loading--light:
- hash: v1.k794b7964.f2c8a5cd75ce9c7ddf2de592775a10549a0b99afcc316f0d3f69ff3ca9696672.GTV3Hl1KhQ6WYStJnBvZ1xqdhF5_GWbfhQ95EKAGzoo
- dashboards-dashboard-widgets-widget-types-session-replay-recent-recordings--populated--dark:
- hash: v1.k794b7964.958f4b80c82746adc9eef284ed54a74376063c6aada1f44d7925f08ecb6f0931.SOzm1gZyj-_Snzcvi0hW9Ykf030glTAqAQPThofD-90
- dashboards-dashboard-widgets-widget-types-session-replay-recent-recordings--populated--light:
- hash: v1.k794b7964.1538a93dea06e033ba6f4af3187d3bf1499679f289e0f8ffbc35f6e9698347ec.T-4IblCjfUSuNvMBQp6aQaHRM7xQIG2uEigvQ-tXKAw
+ hash: v1.k794b7964.50c3acf529b880149a25537357a26f11635c90484822568c711dacf59b6d7ed8.bHVMkCbmy8bQEjO3TflvMy1TZyJJyX6Fdiqvl2SGrhU
dashboards-dashboard-widgets-widget-types-session-replay-recent-recordings--setup-unavailable--dark:
hash: v1.k794b7964.4d843ded3453a2be0dd16f6bb4efe34dd8de634388ed8073cf7c748b6614e186.RKgAGczYSH33uEfBaYGMSlXx7pa4c2QToaJprdtWnKs
dashboards-dashboard-widgets-widget-types-session-replay-recent-recordings--setup-unavailable--light:
hash: v1.k794b7964.6fc2668cd7bab46bf06a6bf27c9932197f83602d8a5bc1235ecf113dd39e498d.qB69GwThpUyt3z_aOk6gUZbTj3vJBfXm3gDR7FzuA50
+ dashboards-dashboard-widgets-widget-types-session-replay-recent-recordings--tile-filters-read-only--dark:
+ hash: v1.k794b7964.1149454c801642f8ede22c9e9bdbf25df31ba976203029366b0397ecbd4b5c7a.tg4SPPDH3dFMUtptr5mjvUgseHCBOCLvdJEGcN-ZMMg
+ dashboards-dashboard-widgets-widget-types-session-replay-recent-recordings--tile-filters-read-only--light:
+ hash: v1.k794b7964.c85c4bac88ef878a5a72f1eb276184f6b9091e2c8f1e19b4db2d555220e21558.RlnAWW9XRd6OuL1cQI18TrVcWv0JpjB_VLaXD4ZIRKQ
dashboards-dashboard-widgets-widget-types-session-replay-recent-recordings-widget-settings--default--dark:
hash: v1.k794b7964.7a360d33ee768adcdd8eacfa769a936e2363321adc21eaff60683098c29d847c.N0ylw1z2Ul0sGiYOCkdb1ot4ON-BoCRxW7s3lJS0tmQ
dashboards-dashboard-widgets-widget-types-session-replay-recent-recordings-widget-settings--default--light:
diff --git a/frontend/src/scenes/dashboard/tileLayouts.test.ts b/frontend/src/scenes/dashboard/tileLayouts.test.ts
index 97b049ec0a63..e340fcdb8107 100644
--- a/frontend/src/scenes/dashboard/tileLayouts.test.ts
+++ b/frontend/src/scenes/dashboard/tileLayouts.test.ts
@@ -120,7 +120,19 @@ describe('calculating tile layouts', () => {
name: 'uses default widget minH when catalog omits minH',
widgetType: 'unknown_widget',
expectedMinH: 4,
- expectedMinW: 6,
+ expectedMinW: 3,
+ },
+ {
+ name: 'uses catalog minW for error tracking list widgets',
+ widgetType: 'error_tracking_list',
+ expectedMinH: 3,
+ expectedMinW: 3,
+ },
+ {
+ name: 'uses catalog minW for session replay list widgets',
+ widgetType: 'session_replay_list',
+ expectedMinH: 3,
+ expectedMinW: 3,
},
])('$name', ({ widgetType, expectedMinH, expectedMinW }) => {
const tiles: DashboardTile<QueryBasedInsightModel>[] = [
diff --git a/frontend/src/scenes/dashboard/tileLayouts.ts b/frontend/src/scenes/dashboard/tileLayouts.ts
index 57b678096975..bf6671e254b9 100644
--- a/frontend/src/scenes/dashboard/tileLayouts.ts
+++ b/frontend/src/scenes/dashboard/tileLayouts.ts
@@ -21,7 +21,7 @@ export interface TileLayout {
const MIN_TILE_HEIGHT_ROWS = 2
const MIN_TEXT_TILE_HEIGHT_ROWS = 1
-const MIN_WIDGET_TILE_WIDTH_COLS = 6
+const MIN_WIDGET_TILE_WIDTH_COLS = 3
const MIN_WIDGET_TILE_HEIGHT_ROWS = 4
type WidgetCatalogLayout = DashboardWidgetCatalogEntry['defaultLayout']
diff --git a/products/conversations/frontend/scenes/tickets/SupportTicketsScene.tsx b/products/conversations/frontend/scenes/tickets/SupportTicketsScene.tsx
index b3cd09c59241..2198e05a7cc7 100644
--- a/products/conversations/frontend/scenes/tickets/SupportTicketsScene.tsx
+++ b/products/conversations/frontend/scenes/tickets/SupportTicketsScene.tsx
@@ -263,14 +263,14 @@ export function SupportTicketsTable({ embedded = false }: SupportTicketsTablePro
useEffect(() => {
setSelectedTicketIds(bulk.selectedKeys)
- }, [bulk.selectedKeys])
+ }, [bulk.selectedKeys, setSelectedTicketIds])
// Clear hook selection when kea resets (e.g. after bulk update or page reload)
useEffect(() => {
if (selectedTicketIds.length === 0 && bulk.selectedKeys.length > 0) {
bulk.clearSelection()
}
- }, [selectedTicketIds, bulk.clearSelection])
+ }, [selectedTicketIds, bulk.clearSelection, bulk, bulk.selectedKeys.length])
const columns = useMemo<LemonTableColumns<Ticket>>(() => {
const checkboxCol: LemonTableColumns<Ticket>[number] = {
diff --git a/products/dashboards/backend/api/dashboard.py b/products/dashboards/backend/api/dashboard.py
index 96ba65461632..c4bdb47ddbd6 100644
--- a/products/dashboards/backend/api/dashboard.py
+++ b/products/dashboards/backend/api/dashboard.py
@@ -100,6 +100,7 @@ from products.dashboards.backend.widget_layouts import (
collect_dashboard_sm_layouts_for_dashboard,
stack_widget_layout_at_bottom,
)
+from products.dashboards.backend.widget_query_throttle import get_dashboard_widget_query_throttle_error
from products.dashboards.backend.widget_registry import (
EXPECTED_WIDGET_TYPES,
SESSION_REPLAY_LIST_WIDGET_TYPE,
@@ -202,6 +203,7 @@ def _run_widget_query(
team,
work_item["config"],
user=work_item["user"],
+ include_total_count=False,
)
return {
"tile_id": tile_id,
@@ -2578,6 +2580,16 @@ class DashboardsViewSet(
}
continue
+ widget_throttle_error = get_dashboard_widget_query_throttle_error(request, self)
+ if widget_throttle_error:
+ results_by_id[tile_id] = {
+ "tile_id": tile_id,
+ "widget_type": widget.widget_type,
+ "result": None,
+ "error": widget_throttle_error,
+ }
+ continue
+
if widget.widget_type == SESSION_REPLAY_LIST_WIDGET_TYPE:
replay_throttle_error = get_replay_listing_throttle_error(request, self)
if replay_throttle_error:
diff --git a/products/dashboards/backend/test/test_widget_query_throttle.py b/products/dashboards/backend/test/test_widget_query_throttle.py
new file mode 100644
index 000000000000..6febe3963e22
--- /dev/null
+++ b/products/dashboards/backend/test/test_widget_query_throttle.py
@@ -0,0 +1,53 @@
+from posthog.test.base import BaseTest
+from unittest.mock import MagicMock, patch
+
+from products.dashboards.backend.widget_query_throttle import (
+ DashboardWidgetQueryBurstRateThrottle,
+ get_dashboard_widget_query_throttle_error,
+)
+
+
+class TestDashboardWidgetQueryThrottle(BaseTest):
+ def test_get_dashboard_widget_query_throttle_error_when_burst_blocks(self) -> None:
+ request = MagicMock()
+ view = MagicMock()
+ view.team_id = self.team.id
+
+ with patch(
+ "products.dashboards.backend.widget_query_throttle.is_rate_limit_enabled",
+ return_value=True,
+ ):
+ with patch(
+ "products.dashboards.backend.widget_query_throttle.DashboardWidgetQueryBurstRateThrottle.allow_request",
+ return_value=False,
+ ):
+ with patch(
+ "products.dashboards.backend.widget_query_throttle.DashboardWidgetQueryBurstRateThrottle.wait",
+ return_value=12,
+ ):
+ with patch(
+ "products.dashboards.backend.widget_query_throttle.DashboardWidgetQuerySustainedRateThrottle.allow_request",
+ return_value=True,
+ ):
+ error = get_dashboard_widget_query_throttle_error(request, view)
+
+ self.assertEqual(error, "Rate limit exceeded. Expected available in 12 seconds.")
+
+ def test_dashboard_widget_burst_throttle_applies_to_session_users(self) -> None:
+ request = MagicMock()
+ request.user.is_authenticated = True
+ view = MagicMock()
+ view.team_id = self.team.id
+
+ with patch(
+ "products.dashboards.backend.widget_query_throttle.is_rate_limit_enabled",
+ return_value=True,
+ ):
+ with patch(
+ "products.dashboards.backend.widget_query_throttle.team_is_allowed_to_bypass_throttle",
+ return_value=False,
+ ):
+ throttle = DashboardWidgetQueryBurstRateThrottle()
+ allow = throttle.allow_request(request, view)
+
+ self.assertIsInstance(allow, bool)
diff --git a/products/dashboards/backend/widget_query_throttle.py b/products/dashboards/backend/widget_query_throttle.py
new file mode 100644
index 000000000000..6c23e7557d50
--- /dev/null
+++ b/products/dashboards/backend/widget_query_throttle.py
@@ -0,0 +1,47 @@
+"""Rate limits for dashboard run_widgets (ClickHouse-backed widget queries)."""
+
+from __future__ import annotations
+
+import time
+
+from posthog.rate_limit import PersonalApiKeyRateThrottle, is_rate_limit_enabled, team_is_allowed_to_bypass_throttle
+
+
+class DashboardWidgetQueryBurstRateThrottle(PersonalApiKeyRateThrottle):
+ """Per-team burst cap on dashboard widget data fetches (web session and API keys)."""
+
+ scope = "dashboard_widget_query_burst"
+ rate = "120/minute"
+
+ def allow_request(self, request, view) -> bool:
+ return self._allow_request_internal(request, view, personal_api_key_only=False)
+
+
+class DashboardWidgetQuerySustainedRateThrottle(PersonalApiKeyRateThrottle):
+ """Per-team sustained cap on dashboard widget data fetches."""
+
+ scope = "dashboard_widget_query_sustained"
+ rate = "600/hour"
+
+ def allow_request(self, request, view) -> bool:
+ return self._allow_request_internal(request, view, personal_api_key_only=False)
+
+
+def get_dashboard_widget_query_throttle_error(request, view) -> str | None:
+ """Return a client-facing error when dashboard widget query throttles would block this request."""
+ if not is_rate_limit_enabled(round(time.time() / 60)):
+ return None
+
+ team_id = PersonalApiKeyRateThrottle.safely_get_team_id_from_view(view)
+ if team_id is not None and team_is_allowed_to_bypass_throttle(team_id):
+ return None
+
+ for throttle_cls in (DashboardWidgetQueryBurstRateThrottle, DashboardWidgetQuerySustainedRateThrottle):
+ throttle = throttle_cls()
+ if throttle.allow_request(request, view):
+ continue
+ wait = throttle.wait()
+ if wait:
+ return f"Rate limit exceeded. Expected available in {wait} seconds."
+ return "Rate limit exceeded. Try again later."
+ return None
diff --git a/products/dashboards/frontend/components/WidgetCard/WidgetCardBody.tsx b/products/dashboards/frontend/components/WidgetCard/WidgetCardBody.tsx
index f422dfc9e78a..ca15e19ddca1 100644
--- a/products/dashboards/frontend/components/WidgetCard/WidgetCardBody.tsx
+++ b/products/dashboards/frontend/components/WidgetCard/WidgetCardBody.tsx
@@ -85,7 +85,7 @@ export function WidgetCardBody({
)
}
-/** Passes flex height from the card shell into widget body content. Scroll lives in `WidgetCardContent`. */
+/** Passes flex height from the card shell into widget body content. */
function WidgetCardBodySlot({ children }: { children: React.ReactNode }): JSX.Element {
return <div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden">{children}</div>
}
@@ -194,20 +194,17 @@ export function WidgetLoadingState({ children, rowCount, className }: WidgetLoad
type WidgetCardContentProps = {
children: React.ReactNode
- footer?: React.ReactNode
className?: string
}
-/** Scrollable widget body — use for all tile content (lists, setup prompts, empty states). */
-export function WidgetCardContent({ children, footer, className }: WidgetCardContentProps): JSX.Element {
+/** Scrollable widget body — compose with optional `WidgetContentFooter` as a sibling. */
+export function WidgetCardContent({ children, className }: WidgetCardContentProps): JSX.Element {
return (
- <div data-slot="widget-card-content" className={clsx('flex min-h-0 min-w-0 flex-1 flex-col gap-2', className)}>
- <div className="min-h-0 min-w-0 flex-1 overflow-y-auto overflow-x-hidden">{children}</div>
- {footer ? (
- <div className="flex shrink-0 justify-center pt-0.5" data-slot="widget-card-content-footer">
- {footer}
- </div>
- ) : null}
+ <div
+ data-slot="widget-card-content"
+ className={clsx('min-h-0 min-w-0 flex-1 overflow-y-auto overflow-x-hidden', className)}
+ >
+ {children}
</div>
)
}
diff --git a/products/dashboards/frontend/components/WidgetCard/index.ts b/products/dashboards/frontend/components/WidgetCard/index.ts
index a7899d87a18a..92336740a74c 100644
--- a/products/dashboards/frontend/components/WidgetCard/index.ts
+++ b/products/dashboards/frontend/components/WidgetCard/index.ts
@@ -4,10 +4,10 @@ export {
WidgetCardBodyMessage,
WidgetCardBodySkeleton,
WidgetCardContent,
- WidgetCardSharedPlaceholderBody,
- type WidgetCardSharedPlaceholderCopy,
WidgetContentFooter,
WidgetListCount,
+ WidgetCardSharedPlaceholderBody,
+ type WidgetCardSharedPlaceholderCopy,
WIDGET_LIST_COUNT_ISSUES,
WIDGET_LIST_COUNT_RECORDINGS,
WidgetLoadingState,
diff --git a/products/dashboards/frontend/components/WidgetCard/widgetCardStoryFixtures.tsx b/products/dashboards/frontend/components/WidgetCard/widgetCardStoryFixtures.tsx
index 3ee4d0ecf922..259847539008 100644
--- a/products/dashboards/frontend/components/WidgetCard/widgetCardStoryFixtures.tsx
+++ b/products/dashboards/frontend/components/WidgetCard/widgetCardStoryFixtures.tsx
@@ -11,7 +11,7 @@ import { teamLogic } from 'scenes/teamLogic'
import { exceptionIngestionLogic } from 'products/error_tracking/frontend/components/SetupPrompt/exceptionIngestionLogic'
-import { WidgetCardContent } from './WidgetCardBody'
+import { WidgetCardContent, WidgetContentFooter } from './WidgetCardBody'
export const TILE_WIDTH = 560
export const TILE_HEIGHT = 480
@@ -61,28 +61,29 @@ export const mockWidgetMoreMenuItems: LemonMenuItems = [
export const mockMoreOverlay = <LemonMenuOverlay items={mockWidgetMoreMenuItems} />
export const sampleListBody = (
- <WidgetCardContent
- footer={
+ <>
+ <WidgetCardContent>
+ <ul className="m-0 flex list-none flex-col gap-3 p-0 text-sm">
+ <li className="rounded border border-primary p-3">
+ <div className="font-semibold">Homepage visits</div>
+ <div className="text-muted">12,480 events · 3,210 users</div>
+ </li>
+ <li className="rounded border border-primary p-3">
+ <div className="font-semibold">Signup conversion</div>
+ <div className="text-muted">842 events · 612 users</div>
+ </li>
+ <li className="rounded border border-primary p-3">
+ <div className="font-semibold">Weekly active users</div>
+ <div className="text-muted">4,102 users · +8% vs last week</div>
+ </li>
+ </ul>
+ </WidgetCardContent>
+ <WidgetContentFooter>
<LemonButton type="secondary" size="small">
View all
</LemonButton>
- }
- >
- <ul className="m-0 flex list-none flex-col gap-3 p-0 text-sm">
- <li className="rounded border border-primary p-3">
- <div className="font-semibold">Homepage visits</div>
- <div className="text-muted">12,480 events · 3,210 users</div>
- </li>
- <li className="rounded border border-primary p-3">
- <div className="font-semibold">Signup conversion</div>
- <div className="text-muted">842 events · 612 users</div>
- </li>
- <li className="rounded border border-primary p-3">
- <div className="font-semibold">Weekly active users</div>
- <div className="text-muted">4,102 users · +8% vs last week</div>
- </li>
- </ul>
- </WidgetCardContent>
+ </WidgetContentFooter>
+ </>
)
export const dashboardTileTopHeading = <CardTopHeadingRow typeLabel="Analytics" showTypeLabel dateText="Last 7 days" />
diff --git a/products/dashboards/frontend/widget_types/catalog.ts b/products/dashboards/frontend/widget_types/catalog.ts
index 43816013162f..385d141aa01c 100644
--- a/products/dashboards/frontend/widget_types/catalog.ts
+++ b/products/dashboards/frontend/widget_types/catalog.ts
@@ -103,7 +103,7 @@ export const DASHBOARD_WIDGET_CATALOG = {
defaultConfig: errorTrackingWidgetConfigSchema.parse({
dateRange: { date_from: '-7d' },
}),
- defaultLayout: { w: 6, h: 5, minW: 6, minH: 3 },
+ defaultLayout: { w: 6, h: 5, minW: 3, minH: 3 },
productAccess: 'error_tracking',
titleHref: urls.errorTracking(),
sharedPlaceholder: {
@@ -123,7 +123,7 @@ export const DASHBOARD_WIDGET_CATALOG = {
defaultConfig: sessionReplayWidgetConfigSchema.parse({
dateRange: { date_from: '-7d' },
}),
- defaultLayout: { w: 6, h: 5, minW: 6, minH: 3 },
+ defaultLayout: { w: 6, h: 5, minW: 3, minH: 3 },
productAccess: 'session_recording',
titleHref: urls.replay(),
sharedPlaceholder: {
@@ -193,7 +193,7 @@ export function getUnknownDashboardWidgetCatalogFallback(widgetType: string): Re
label: widgetType,
description: '',
defaultConfig: {},
- defaultLayout: { w: 6, h: 5, minW: 6 },
+ defaultLayout: { w: 6, h: 5, minW: 3 },
headerTitle: widgetType,
headerLayout: DEFAULT_DASHBOARD_WIDGET_HEADER_LAYOUT,
headerMeta: DEFAULT_DASHBOARD_WIDGET_HEADER_META,
diff --git a/products/dashboards/frontend/widgets/session_replay/SessionReplayWidget.stories.tsx b/products/dashboards/frontend/widgets/session_replay/SessionReplayWidget.stories.tsx
index e6a6290b0995..a23ab9958252 100644
--- a/products/dashboards/frontend/widgets/session_replay/SessionReplayWidget.stories.tsx
+++ b/products/dashboards/frontend/widgets/session_replay/SessionReplayWidget.stories.tsx
@@ -15,8 +15,11 @@ import {
import { sessionReplaySampleRecordings } from '../../components/WidgetCard/widgetOverviewStoryFixtures'
import { WidgetRuntimeAvailabilityGuard } from '../../components/WidgetRuntimeAvailabilityGuard/WidgetRuntimeAvailabilityGuard'
import { getDashboardWidgetCatalogEntry, getDashboardWidgetGroupLabel } from '../../widget_types/catalog'
+import { useWidgetAvailability } from '../../widget_types/widgetAvailability'
+import { DASHBOARD_WIDGET_TILE_FILTERS_READONLY_REASON } from '../constants'
import type { DashboardWidgetComponentProps } from '../registry'
import { SessionReplayWidget } from './SessionReplayWidget'
+import { SessionReplayWidgetTileFilters } from './SessionReplayWidgetTileFilters'
const SESSION_REPLAY_CATALOG = getDashboardWidgetCatalogEntry('session_replay_list')!
const DEFAULT_CONFIG = SESSION_REPLAY_CATALOG.defaultConfig as Record<string, unknown>
@@ -26,6 +29,9 @@ type SessionReplayWidgetTileStoryProps = DashboardWidgetComponentProps & {
description?: string
showDescription?: boolean
body?: ReactNode
+ filterBar?: ReactNode
+ /** When true, tile filter bar matches view-only dashboard access (no edit permissions). */
+ tileFiltersReadOnly?: boolean
}
function SessionReplayWidgetTileStory({
@@ -33,10 +39,13 @@ function SessionReplayWidgetTileStory({
description = 'Recent session recordings you can open in the replay player.',
showDescription = true,
body,
+ filterBar,
+ tileFiltersReadOnly = false,
...widgetProps
}: SessionReplayWidgetTileStoryProps): JSX.Element {
const widgetTypeLabel = getDashboardWidgetGroupLabel(SESSION_REPLAY_CATALOG.groupId)
const defaultTitle = SESSION_REPLAY_CATALOG.headerTitle ?? SESSION_REPLAY_CATALOG.label
+ const { isAvailable: showTileFilters } = useWidgetAvailability(SESSION_REPLAY_CATALOG.availability)
return (
<WidgetCard className="h-full">
@@ -54,6 +63,18 @@ function SessionReplayWidgetTileStory({
shouldHideMoreButton={widgetCardShouldHideMoreButton(DashboardPlacement.Dashboard, false)}
moreButtonOverlay={mockMoreOverlay}
/>
+ {showTileFilters
+ ? (filterBar ?? (
+ <SessionReplayWidgetTileFilters
+ tileId={widgetProps.tileId ?? 1}
+ config={widgetProps.config}
+ onUpdateConfig={tileFiltersReadOnly ? undefined : widgetProps.onUpdateConfig}
+ disabledReason={
+ tileFiltersReadOnly ? DASHBOARD_WIDGET_TILE_FILTERS_READONLY_REASON : undefined
+ }
+ />
+ ))
+ : null}
<WidgetCardBody>{body ?? <SessionReplayWidget {...widgetProps} />}</WidgetCardBody>
</WidgetCard>
)
@@ -81,7 +102,7 @@ export default meta
type Story = StoryObj<typeof SessionReplayWidgetTileStory>
-export const Populated: Story = {
+export const Default: Story = {
decorators: [withSessionReplayProjectState(true)],
args: {
title: 'Recent recordings',
@@ -91,6 +112,44 @@ export const Populated: Story = {
results: sessionReplaySampleRecordings,
hasMore: true,
limit: 10,
+ totalCount: 25,
+ totalCountCapped: true,
+ },
+ },
+}
+
+export const TileFiltersReadOnly: Story = {
+ decorators: [withSessionReplayProjectState(true)],
+ args: {
+ title: 'Recent recordings',
+ config: {
+ ...DEFAULT_CONFIG,
+ dateRange: { date_from: '-30d' },
+ widgetFilters: {
+ 'qf-browser': {
+ filterId: 'qf-browser',
+ propertyName: '$browser',
+ optionId: 'opt-chrome',
+ operator: 'exact',
+ value: 'Chrome',
+ },
+ },
+ },
+ tileFiltersReadOnly: true,
+ loading: false,
+ result: {
+ results: sessionReplaySampleRecordings,
+ hasMore: true,
+ limit: 10,
+ totalCount: 25,
+ totalCountCapped: true,
+ },
+ },
+ parameters: {
+ docs: {
+ description: {
+ story: 'Tile filter bar when the viewer lacks dashboard edit access — date range and property filters are disabled.',
+ },
},
},
}
diff --git a/products/dashboards/frontend/widgets/session_replay/SessionReplayWidget.test.tsx b/products/dashboards/frontend/widgets/session_replay/SessionReplayWidget.test.tsx
index 1876fd629a7d..9a2e14d17b44 100644
--- a/products/dashboards/frontend/widgets/session_replay/SessionReplayWidget.test.tsx
+++ b/products/dashboards/frontend/widgets/session_replay/SessionReplayWidget.test.tsx
@@ -43,11 +43,69 @@ describe('SessionReplayWidget', () => {
tileId={1}
config={{ limit: 10 }}
loading={false}
- result={{ results: [recording], hasMore: false, limit: 10 }}
+ result={{
+ results: [recording],
+ hasMore: false,
+ limit: 10,
+ totalCount: 1,
+ totalCountCapped: false,
+ }}
/>
)
expect(screen.getByText('recording-1')).toBeInTheDocument()
+ expect(screen.getByText('1 of 1 recording')).toBeInTheDocument()
+ })
+
+ it('shows capped total in footer when more recordings exist than the count cap', () => {
+ render(
+ <SessionReplayWidget
+ tileId={1}
+ config={{ limit: 1 }}
+ loading={false}
+ result={{
+ results: [recording],
+ hasMore: true,
+ limit: 1,
+ totalCount: 25,
+ totalCountCapped: true,
+ }}
+ />
+ )
+
+ expect(screen.getByText('1 of 25+ recordings')).toBeInTheDocument()
+ })
+
+ it('shows lower-bound footer when hasMore and total count was not fetched', () => {
+ render(
+ <SessionReplayWidget
+ tileId={1}
+ config={{ limit: 1 }}
+ loading={false}
+ result={{ results: [recording], hasMore: true, limit: 1 }}
+ />
+ )
+
+ expect(screen.getByText('1+ recording')).toBeInTheDocument()
+ })
+
+ it('shows exact total in footer when hasMore and total is known', () => {
+ render(
+ <SessionReplayWidget
+ tileId={1}
+ config={{ limit: 1 }}
+ loading={false}
+ result={{
+ results: [recording],
+ hasMore: true,
+ limit: 1,
+ totalCount: 4,
+ totalCountCapped: false,
+ }}
+ />
+ )
+
+ expect(screen.getByText('1 of 4 recordings')).toBeInTheDocument()
})
it('renders an empty state when there are no recordings', () => {
diff --git a/products/dashboards/frontend/widgets/session_replay/SessionReplayWidget.tsx b/products/dashboards/frontend/widgets/session_replay/SessionReplayWidget.tsx
index 25ba0493bf89..00227a94f05c 100644
--- a/products/dashboards/frontend/widgets/session_replay/SessionReplayWidget.tsx
+++ b/products/dashboards/frontend/widgets/session_replay/SessionReplayWidget.tsx
@@ -12,7 +12,13 @@ import { sessionRecordingEventUsageLogic } from 'scenes/session-recordings/sessi
import type { RecordingsQuery } from '~/queries/schema/schema-general'
import type { SessionRecordingType } from '~/types'
-import { WidgetCardBodyMessage, WidgetCardContent } from '../../components/WidgetCard'
+import {
+ WidgetCardBodyMessage,
+ WidgetCardContent,
+ WidgetContentFooter,
+ WidgetListCount,
+ WIDGET_LIST_COUNT_RECORDINGS,
+} from '../../components/WidgetCard'
import type { DashboardWidgetComponentProps } from '../registry'
import { parseSessionReplayWidgetConfig } from './sessionReplayWidgetConfigValidation'
@@ -20,6 +26,8 @@ type SessionReplayWidgetResult = {
results?: SessionRecordingType[]
hasMore?: boolean
limit?: number
+ totalCount?: number
+ totalCountCapped?: boolean
}
function SessionReplayWidgetRecordingRow({
@@ -82,12 +90,24 @@ export function SessionReplayWidget({ result, loading, config }: DashboardWidget
}
return (
- <WidgetCardContent>
- <div className="flex flex-col">
- {recordings.map((recording) => (
- <SessionReplayWidgetRecordingRow key={recording.id} recording={recording} order={order} />
- ))}
- </div>
- </WidgetCardContent>
+ <>
+ <WidgetCardContent>
+ <div className="flex flex-col">
+ {recordings.map((recording) => (
+ <SessionReplayWidgetRecordingRow key={recording.id} recording={recording} order={order} />
+ ))}
+ </div>
+ </WidgetCardContent>
+ <WidgetContentFooter>
+ <WidgetListCount
+ shown={recordings.length}
+ totalCount={payload?.totalCount}
+ totalCountIsLowerBound={payload?.totalCountCapped}
+ noun={WIDGET_LIST_COUNT_RECORDINGS}
+ hasMore={payload?.hasMore}
+ dataAttr="session-replay-widget-count"
+ />
+ </WidgetContentFooter>
+ </>
)
}