Skip to content

CLOSED#60495

Closed
MattPua wants to merge 1 commit into
05-28-feat_dashboards_add_widget_registry_run_widgets_and_dashboard_widget_apifrom
05-28-feat_dashboards_add_widgetcard_shell_and_error_tracking_dashboard_widget
Closed

CLOSED#60495
MattPua wants to merge 1 commit into
05-28-feat_dashboards_add_widget_registry_run_widgets_and_dashboard_widget_apifrom
05-28-feat_dashboards_add_widgetcard_shell_and_error_tracking_dashboard_widget

Conversation

@MattPua
Copy link
Copy Markdown
Member

@MattPua MattPua commented May 28, 2026

Problem

Users need embeddable product surfaces on dashboards — starting with error tracking issues. This PR adds the shared WidgetCard shell, catalog/registry UX, and dashboard scene glue for the error tracking widget.

This PR is 7/10 in the dashboard widgets Graphite stack.

Depends on: PR 6 (backend widget API + error tracking runner)

Changes

  • WidgetCard compound components, DashboardWidgetItem, add-widget modal, catalog/registry
  • Error tracking widget UI (component, edit modal, preview, stories, tests)
  • Dashboard scene integration: dashboardLogic, DashboardItems, widgetFetchUtils
  • Shared card chrome: CardTopHeadingRow, refresh button
  • ErrorTrackingIssueList tweaks for dashboard embedding
  • Session replay widget not included (PR 8)

How did you test this code?

  • Agent: ran Jest tests for widget registry, WidgetCard, error tracking widget during development
  • Feature remains behind dashboard widgets feature flag

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Publish to changelog?

no — still feature flagged

Docs update

skip-inkeep-docs

🤖 Agent context

  • Frontend slice scoped to error tracking only so QA can validate one widget type end-to-end before session replay
  • Uses generated API types from PR 6

@MattPua MattPua force-pushed the 05-28-feat_dashboards_add_widgetcard_shell_and_error_tracking_dashboard_widget branch from d06831b to e7e58c4 Compare May 28, 2026 17:23
@MattPua MattPua force-pushed the 05-28-feat_dashboards_add_widget_registry_run_widgets_and_dashboard_widget_api branch from d6c56cc to 401407a Compare May 28, 2026 17:23
@MattPua MattPua force-pushed the 05-28-feat_dashboards_add_widgetcard_shell_and_error_tracking_dashboard_widget branch from e7e58c4 to c801c9e Compare May 28, 2026 18:51
@MattPua MattPua force-pushed the 05-28-feat_dashboards_add_widget_registry_run_widgets_and_dashboard_widget_api branch from 401407a to e2f22c0 Compare May 28, 2026 18:51
@MattPua MattPua force-pushed the 05-28-feat_dashboards_add_widgetcard_shell_and_error_tracking_dashboard_widget branch from c801c9e to 325b2df Compare May 28, 2026 19:32
@MattPua MattPua mentioned this pull request May 28, 2026
@MattPua MattPua force-pushed the 05-28-feat_dashboards_add_widgetcard_shell_and_error_tracking_dashboard_widget branch from 325b2df to b33da61 Compare May 28, 2026 19:35
@MattPua MattPua force-pushed the 05-28-feat_dashboards_add_widgetcard_shell_and_error_tracking_dashboard_widget branch from b33da61 to 842c5d4 Compare May 28, 2026 19:39
@MattPua MattPua changed the title feat(dashboards): add WidgetCard shell and error tracking dashboard widget feat(dashboards): add WidgetCard shell and error tracking dashboard widget (7/10) May 28, 2026
…idget

Co-authored-by: Cursor <cursoragent@cursor.com>
@MattPua MattPua force-pushed the 05-28-feat_dashboards_add_widget_registry_run_widgets_and_dashboard_widget_api branch from b073eaf to 579a9c0 Compare May 28, 2026 19:43
@MattPua MattPua force-pushed the 05-28-feat_dashboards_add_widgetcard_shell_and_error_tracking_dashboard_widget branch from 842c5d4 to 74e73f0 Compare May 28, 2026 19:43
@MattPua MattPua marked this pull request as ready for review May 28, 2026 19:46
@MattPua MattPua marked this pull request as draft May 28, 2026 19:46
@assign-reviewers-posthog assign-reviewers-posthog Bot requested review from a team, ablaszkiewicz and hpouillot May 28, 2026 19:46
@assign-reviewers-posthog assign-reviewers-posthog Bot requested a review from cat-ph May 28, 2026 19:46
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 28, 2026

Prompt To Fix All With AI
Fix the following 3 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 3
products/dashboards/frontend/widgets/registry.tsx:89-99
**Broken registry object — compilation failure**

Lines 95–98 are a leftover stub for the session-replay widget that was never completed. The entry is missing its key name and opening `{`, so the object literal has a mismatched closing `},` on line 98 that causes a JS/TS parse error. Additionally, `SessionReplayWidget` and `EditSessionReplayWidgetModal` are referenced but never imported, so this would also fail with "cannot find name" errors. The PR description says session replay is deferred to PR 8 — these lines need to be removed entirely before merging.

### Issue 2 of 3
products/dashboards/frontend/widget_types/catalog.ts:58-61
**Stray comma causes a syntax error**

Line 60 is a bare `,` with no property, producing an invalid object literal (`{a:1,,}` is not legal JS/TS). This appears to be a leftover placeholder for the session-replay catalog entry that should be removed.

```suggestion
        titleHref: urls.errorTracking(),
    },
} as const satisfies Record<string, DashboardWidgetCatalogEntry>
```

### Issue 3 of 3
frontend/src/scenes/dashboard/dashboardLogic.tsx:1834-1843
**`Public` placement now silently skips insight refresh**

Previously `handleDashboardLoadComplete` called `refreshDashboardItems` for every placement except `Export`; public-shared dashboards would therefore fetch fresh ClickHouse results. After this change, `DashboardPlacement.Public` is also excluded, so insight tiles on public/shared dashboards will stop showing live query results and fall back to whatever was embedded in the initial `loadDashboard` response. If the intent is to intentionally serve only cached data on public dashboards, this should be documented; otherwise it is a regression that will be invisible to the author but visible to all external viewers.

Reviews (1): Last reviewed commit: "feat(dashboards): add WidgetCard shell a..." | Re-trigger Greptile

Comment on lines 1834 to 1843
},
handleDashboardLoadComplete: () => {
// Shared logic for refreshing dashboard items after load (used by both regular and streaming loads)
if (values.placement !== DashboardPlacement.Export) {
// access stored values from dashboardLoadData
// as we can't pass them down to this listener
if (
values.placement !== DashboardPlacement.Export &&
values.placement !== DashboardPlacement.Public
) {
const loadAction = values.dashboardLoadData.action!
actions.refreshDashboardItems({ action: loadAction, forceRefresh: false })
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Public placement now silently skips insight refresh

Previously handleDashboardLoadComplete called refreshDashboardItems for every placement except Export; public-shared dashboards would therefore fetch fresh ClickHouse results. After this change, DashboardPlacement.Public is also excluded, so insight tiles on public/shared dashboards will stop showing live query results and fall back to whatever was embedded in the initial loadDashboard response. If the intent is to intentionally serve only cached data on public dashboards, this should be documented; otherwise it is a regression that will be invisible to the author but visible to all external viewers.

Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/src/scenes/dashboard/dashboardLogic.tsx
Line: 1834-1843

Comment:
**`Public` placement now silently skips insight refresh**

Previously `handleDashboardLoadComplete` called `refreshDashboardItems` for every placement except `Export`; public-shared dashboards would therefore fetch fresh ClickHouse results. After this change, `DashboardPlacement.Public` is also excluded, so insight tiles on public/shared dashboards will stop showing live query results and fall back to whatever was embedded in the initial `loadDashboard` response. If the intent is to intentionally serve only cached data on public dashboards, this should be documented; otherwise it is a regression that will be invisible to the author but visible to all external viewers.

How can I resolve this? If you propose a fix, please make it concise.

@MattPua
Copy link
Copy Markdown
Member Author

MattPua commented May 28, 2026

Split into #60523 (WidgetCard shell) and #60524 (error tracking widget).

@MattPua MattPua closed this May 28, 2026
@MattPua MattPua changed the title feat(dashboards): add WidgetCard shell and error tracking dashboard widget (7/10) feat(dashboards): add WidgetCard shell and error tracking dashboard widget (7/12) May 28, 2026
@MattPua MattPua changed the title feat(dashboards): add WidgetCard shell and error tracking dashboard widget (7/12) feat(dashboards): add WidgetCard shell and error tracking dashboard widget May 28, 2026
@MattPua MattPua changed the title feat(dashboards): add WidgetCard shell and error tracking dashboard widget CLOSED May 28, 2026
@MattPua MattPua deleted the 05-28-feat_dashboards_add_widgetcard_shell_and_error_tracking_dashboard_widget branch May 28, 2026 20:22
MattPua added a commit that referenced this pull request Jun 1, 2026
…7/11) (#60523)

## Problem

Dashboard widgets need shared frontend shell components before any concrete widget type lands. This PR adds the WidgetCard compound component, add-widget modal, catalog/registry scaffolding, and dashboard scene glue with an empty widget catalog.

This PR is **7/11** in the dashboard widgets Graphite stack.

**Depends on:** PR 6 (#60494 — widget registry and run_widgets API)

## Changes

- `WidgetCard` compound components, `DashboardWidgetItem`, add-widget modal, widget type picker
- Empty `DASHBOARD_WIDGET_CATALOG` and `DASHBOARD_WIDGET_REGISTRY` (concrete types in follow-up PRs)
- Dashboard scene integration: `dashboardLogic`, `DashboardItems`, `widgetFetchUtils`, empty-dashboard UX
- Shared card chrome: `CardTopHeadingRow`, `DashboardTileRefreshDataButton`
- Widget availability guard and setup prompt infrastructure
- Jest tests for shell components and registry scaffolding

## How did you test this code?

- Agent: ran Jest tests for WidgetCard, DashboardWidgetItem, registry scaffolding, and widget availability during development
- Feature remains behind dashboard widgets feature flag

👉 _Stay up-to-date with [PostHog coding conventions](https://posthog.com/docs/contribute/coding-conventions) for a smoother review._

## Publish to changelog?

no — still feature flagged

## Docs update

skip-inkeep-docs

## 🤖 Agent context

- Split from former PR #60495 so shell UI can review independently of error tracking widget implementation
- Catalog and registry intentionally empty; error tracking registers in PR 8 (#60524)
MattPua added a commit that referenced this pull request Jun 3, 2026
## Problem

Dashboards need embeddable product widgets beyond insights. Error tracking issues are the first list-style widget: a ranked table of top issues that fits the WidgetCard shell and establishes patterns later widgets (session replay, etc.) reuse.

This PR is **8/11** in the dashboard widgets Graphite stack (WidgetCard shell #60523 is merged).

## Changes

- **`error_tracking_list`** **widget** — catalog/registry entry, backend runner, config schema, preview, and full frontend tile (component, edit modal, stories, tests)
- **`ErrorTrackingIssueList`** **extraction** — shared list component + skeleton for dashboard embedding without pulling in the full error tracking scene
- **Shared edit-modal infrastructure** — `editWidgetModalBuilders`, tile/filter section components, `buildWidgetTileMetadataPatch`, and kea patterns both widget types inherit
- **Shared dashboard tile orchestration** (used by all widget types on this branch):
    - Single PATCH save via `updateWidgetTile` / `updateDashboardWidgetTile` (config + name + description)
    - `useAsyncActions` so edit modals await save before closing
    - Refresh widget data after duplicate
    - Unknown widget types: header + ⋯ menu stay usable; body-only `ErrorBoundary` (no fetch-error refresh UI)
    - Catalog setup prompts use stacked vertical `WidgetCardProductIntroduction`
    - New widgets append to the bottom row of the layout (not lowest-segment gap fill)
    - Server analytics: `dashboard widget added` alongside existing `dashboard tile added`
- **Catalog header defaults** — `getDashboardWidgetCatalogEntry` / `tryGetDashboardWidgetCatalogEntry` resolve layout and header metadata
- **Review follow-ups** — validation wiring, table layout/sparkline fixes, kea typegen-safe modal logic, Storybook/VR baseline updates

## How did you test this code?

- Agent: Jest for error tracking widget, edit modal, registry, add-widget modal, config validation, `DashboardWidgetItem`, and `dashboardLogic` widget tile updates
- Agent: backend `test_dashboard_widgets`, `test_run_widgets`, and `test_widget_layouts`
- Feature remains behind the dashboard widgets feature flag

👉 _Stay up-to-date with_ [_PostHog coding conventions_](https://posthog.com/docs/contribute/coding-conventions) _for a smoother review._

## Automatic notifications

- [ ] Publish to changelog?
- [x] Alert Sales and Marketing teams?

## Docs update

Add the `skip-inkeep-docs` label — no user-facing docs yet (feature flagged). Agent skill/docs land in #60516.

## 🤖 Agent context

- Split from former monolithic PR #60495; WidgetCard glue merged in #60523; session replay lands in #60496
- Several shared dashboard fixes landed here because they touch `dashboardLogic`, `DashboardWidgetItem`, and backend tile create paths used by every widget type
- Cursor agent assisted on review fixes, CI resolution, and post-ship UX polish (save flow, error boundaries, layout placement)
MattPua added a commit that referenced this pull request Jun 3, 2026
## Problem

Session recordings belong on dashboards alongside error tracking. This PR adds the second list-style widget (`session_replay_list`) and generalizes backend config handling so multiple widget types can share the same create/update/run paths.

This PR is **9/11** in the dashboard widgets Graphite stack.

**Depends on:** PR 8 (#60524 — error tracking dashboard widget + shared tile orchestration)

## Changes

- **`session_replay_list`** **widget** — backend runner (reuses session recording list query + serializer shim), catalog/registry, config schema, preview, and frontend tile (component, edit modal, stories, tests)
- **Setup gating** — catalog `availability` (`session_replay_enabled`) via `WidgetRuntimeAvailabilityGuard` + stacked vertical setup prompt when replay is disabled
- **Generic widget config API** — replace error-tracking-only request serializers with `JSONField` + catalog schema hints so ET and SR configs don't cross-pollinate
- **`run_widgets`** **replay throttling** — apply existing replay listing rate limits when batch-running session replay tiles (via `get_replay_listing_throttle_error`)
- **Shared frontend patterns with ET** — edit modal uses shared tile builders/filter sections; config validation and form schemas deduped into shared helpers (`widgetConfigValidation`, `widgetListFormSchema`)
- **Single-patch save** — session replay edit modal submits config + tile metadata in one `onSave(config, buildWidgetTileMetadataPatch(...))` call, matching #60524
- **Backend validation parity** — shared list-widget validators (limit, order, date range) with tests in `test_run_widgets`
- **Review follow-ups** — aligned SR structure with ET (catalog defaults, kea typegen-safe modal logic, removed redundant property prefetch)

## How did you test this code?

- Agent: Jest for session replay widget, edit modal, preview, registry, and config validation
- Agent: backend `test_run_widgets` for session replay runner and config validation cases
- Verified preview renders with shared session recording Storybook fixtures

👉 _Stay up-to-date with_ [_PostHog coding conventions_](https://posthog.com/docs/contribute/coding-conventions) _for a smoother review._

## Automatic notifications

- [ ] Publish to changelog?
- [x] Alert Sales and Marketing teams?

## Docs update

Add the `skip-inkeep-docs` label — no user-facing docs yet (feature flagged). Agent skill/docs land in #60516.

## 🤖 Agent context

- Restacked onto #60524 after #60495 was closed; branch name still references batch add API but batch create already exists on master — this PR is the session replay widget + multi-type config generalization
- Load-more pagination intentionally omitted from widgets per product decision
- Cursor agent assisted on review alignment, CI fixes, and single-patch save parity with ET
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant