mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 16:39:05 +00:00
## Problem The deliveries table polled the API every 5 seconds, for as long as the page was open. Studio tables are not polled by default, and polling is only needed here because delivery results arrive asynchronously. Stacked on #52314. Linear: [FE-3750](https://linear.app/supabase/issue/FE-3750/add-pagination-to-platform-webhooks-deliveries-table) ## Solution - Deliveries are no longer polled by default. - A **Live** button turns polling on (every 5 seconds), and a **Refresh** button reloads once. - Polling also turns on by itself while a delivery is pending, and after a test event or retry is sent until its delivery appears (30 seconds at most). The action never looks like it did nothing. - Hovering a failed delivery explains that failed deliveries are usually retried automatically. The API returns no retry state yet, so a scheduled retry only shows up once its attempt starts. ## Review instructions 1. Enable the Platform Webhooks feature preview, open an endpoint with deliveries, and filter DevTools > Network by `deliveries`. No request repeats on its own. 2. Click Refresh. One request is sent. 3. Click Live. A request is sent every 5 seconds and the dot pulses. Click Live again and the requests stop. 4. Send a test event. Requests repeat for a few seconds until the new row appears, then stop. 5. Set the endpoint URL to `https://httpbin.org/delay/10` and send a test event. While the new row shows `pending`, requests repeat. Once it shows `success`, they stop. 6. Hover a `failure` badge. The retry tooltip shows.
32 lines
1.2 KiB
TypeScript
32 lines
1.2 KiB
TypeScript
import type { WebhookEventType } from '@/data/platform-webhooks/platform-webhooks-fetchers'
|
|
|
|
// The full list of event types the real API accepts, identical for organization-scoped
|
|
// and project-scoped endpoints.
|
|
export const PLATFORM_WEBHOOK_EVENT_TYPES = [
|
|
'v1.project.paused',
|
|
'v1.project.created',
|
|
'v1.project.restored',
|
|
'v1.project.transferred',
|
|
'v1.project.removed',
|
|
'v1.project.restarted',
|
|
'v1.project.status.changed',
|
|
'v1.project.backup.started',
|
|
'v1.project.branch.created',
|
|
'v1.project.branch.updated',
|
|
'v1.project.branch.removed',
|
|
'v1.organization.member.invitation.created',
|
|
'v1.organization.member.invitation.canceled',
|
|
'v1.organization.member.added',
|
|
'v1.organization.member.removed',
|
|
'v1.organization.member.role.assigned',
|
|
'v1.organization.member.role.removed',
|
|
'v1.organization.member.role.updated',
|
|
'v1.organization.billing.plan.upgraded',
|
|
'v1.organization.billing.plan.downgraded',
|
|
] as const satisfies readonly WebhookEventType[]
|
|
|
|
// Rows requested per page of the deliveries table (the API pages by cursor, not page number).
|
|
export const DELIVERIES_PAGE_SIZE = 5
|
|
export const DELIVERIES_POLL_INTERVAL_MS = 5000
|
|
export const AWAITING_DELIVERY_TIMEOUT_MS = 30_000
|