: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(dashboards): handle cleared activity event filter (#88092)
Matt Puac954a8031d88
diff --git a/products/dashboards/frontend/widgets/activity/ActivityEventsWidgetTileFilters.test.tsx b/products/dashboards/frontend/widgets/activity/ActivityEventsWidgetTileFilters.test.tsxindex 4c91f0ae2ed3..8033afc3d81e 100644--- a/products/dashboards/frontend/widgets/activity/ActivityEventsWidgetTileFilters.test.tsx+++ b/products/dashboards/frontend/widgets/activity/ActivityEventsWidgetTileFilters.test.tsx@@ -8,7 +8,11 @@ import { WIDGET_TILE_REFRESH_DEBOUNCE_MS } from '../constants'import { ActivityEventsWidgetTileFilters } from './ActivityEventsWidgetTileFilters'jest.mock('products/actions/frontend/components/EventName', () => ({- EventName: (): JSX.Element => <div>Event name filter</div>,+ EventName: ({ onChange }: { onChange: (value: string | null) => void }): JSX.Element => (+ <button type="button" onClick={() => onChange('')}>+ Clear event filter+ </button>+ ),}))jest.mock('~/queries/nodes/EventsNode/EventPropertyFilters', () => ({@@ -91,4 +95,29 @@ describe('ActivityEventsWidgetTileFilters', () => {properties: [],})})++ it('persists a cleared event filter as null', async () => {+ const onUpdateConfig = jest.fn().mockResolvedValue(undefined)++ render(+ <ActivityEventsWidgetTileFilters+ tileId={1}+ config={{ limit: 10, dateRange: { date_from: '-7d' }, eventName: '$pageview' }}+ onUpdateConfig={onUpdateConfig}+ />+ )++ fireEvent.click(screen.getByText('Clear event filter'))++ await act(async () => {+ await Promise.resolve()+ })++ expect(onUpdateConfig).toHaveBeenCalledWith({+ limit: 10,+ dateRange: { date_from: '-7d' },+ eventName: null,+ properties: undefined,+ })+ })})diff --git a/products/dashboards/frontend/widgets/activity/ActivityEventsWidgetTileFilters.tsx b/products/dashboards/frontend/widgets/activity/ActivityEventsWidgetTileFilters.tsxindex b40825f616fa..daad72c70287 100644--- a/products/dashboards/frontend/widgets/activity/ActivityEventsWidgetTileFilters.tsx+++ b/products/dashboards/frontend/widgets/activity/ActivityEventsWidgetTileFilters.tsx@@ -97,7 +97,7 @@ export function ActivityEventsWidgetTileFilters({disabled={!canUpdate}placeholder="All events"onChange={(value) => {- void applyEventName(value)+ void applyEventName(value === '' ? null : value)}}/>{canUpdate && (