mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 23:49:03 +00:00
## Problem The webhook deliveries table has a search input and sortable column headers, but they only act on the page of rows already loaded (5 rows). The backend uses cursor pagination and has no server-side filtering or sorting, so searching for a term that isn't on the visible page shows "No deliveries found" even when matches exist. This looks broken. Closes FE-4762. The follow-up to bring these back once the backend supports it is tracked in DEPR-709. ## Solution - Removed the search input, its focus shortcut, and the `deliverySearch` URL state from the deliveries table. - Removed the sort controls from the column headers. Headers are now plain text. - Removed the unused `filterWebhookDeliveries` helper and its test. Rows now render in the order the API returns them. - Updated the empty state copy, since it referred to adjusting a search. - Cursor pagination is unchanged. ## How to test 1. Open a project's webhooks page and select an endpoint with deliveries. 2. Check that the Deliveries section has no search input, only the Live toggle and the refresh button. 3. Check that the column headers (Status, Event, Response, Attempted) are not clickable and show no sort icons. 4. Check that the previous and next page buttons still page through deliveries. 5. Select an endpoint with no deliveries and check that the empty state reads "Webhook attempts will show up here once this endpoint receives events."
52 lines
1.7 KiB
TypeScript
52 lines
1.7 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import type { WebhookEndpoint } from './PlatformWebhooks.types'
|
|
import { filterWebhookEndpoints, getWebhookEndpointDisplayName } from './PlatformWebhooks.utils'
|
|
|
|
const createEndpoint = (overrides: Partial<WebhookEndpoint> = {}): WebhookEndpoint => ({
|
|
id: 'endpoint-1',
|
|
url: 'https://hooks.example.com/billing',
|
|
description: '',
|
|
enabled: true,
|
|
eventTypes: ['v1.project.updated'],
|
|
customHeaders: [],
|
|
createdBy: 'user@supabase.io',
|
|
createdAt: '2026-03-16T00:00:00.000Z',
|
|
...overrides,
|
|
})
|
|
|
|
describe('PlatformWebhooks.utils', () => {
|
|
it('combines the endpoint url and subscribed event types', () => {
|
|
expect(
|
|
getWebhookEndpointDisplayName({
|
|
url: 'https://hooks.example.com/billing',
|
|
eventTypes: ['v1.project.paused', 'v1.project.created'],
|
|
})
|
|
).toBe('https://hooks.example.com/billing (v1.project.paused, v1.project.created)')
|
|
})
|
|
|
|
it('shows "all events" when subscribed to every event type', () => {
|
|
expect(
|
|
getWebhookEndpointDisplayName({
|
|
url: 'https://hooks.example.com/billing',
|
|
eventTypes: ['*'],
|
|
})
|
|
).toBe('https://hooks.example.com/billing (all events)')
|
|
})
|
|
|
|
it('filters endpoints by url and description', () => {
|
|
const endpoints = [
|
|
createEndpoint({ id: '1', url: 'https://hooks.example.com/billing' }),
|
|
createEndpoint({
|
|
id: '2',
|
|
url: 'https://hooks.slack.com/x',
|
|
description: 'operational alerts',
|
|
}),
|
|
]
|
|
|
|
expect(filterWebhookEndpoints(endpoints, 'billing')).toEqual([endpoints[0]])
|
|
expect(filterWebhookEndpoints(endpoints, 'slack')).toEqual([endpoints[1]])
|
|
expect(filterWebhookEndpoints(endpoints, 'alerts')).toEqual([endpoints[1]])
|
|
})
|
|
})
|