mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
## Problem The deliveries table loaded one page from the API and split it into pages of 5 in the browser, so older deliveries could not be reached. Linear: [FE-3750](https://linear.app/supabase/issue/FE-3750/add-pagination-to-platform-webhooks-deliveries-table) ## Solution - **Cursor pagination:** the table requests deliveries 5 at a time (`page[after]`), and Next and Previous load the next or previous page. It asks for 6 and shows 5, so Next is never enabled on an empty page. Previous uses the history of cursors we visited, because the API's `prev` link can skip a row or land on an empty page. - The footer reads "Showing N deliveries" (the API returns no total). The delivery search still filters only the loaded page. - **Loading and errors:** skeleton rows show while a page loads, and a failed load shows an error with a Try again button instead of "No deliveries found", and polling stops until you retry. If a later refresh fails, the loaded rows stay with a notice that they may be out of date, and polling continues. - Retry and Send test event refresh every cached page of the endpoint's deliveries. Switching endpoints starts again on page 1. - Retry from the details sheet now works for a delivery that is not on the current page. - A pending delivery has no result yet, so its row no longer opens the details sheet. Its Retry button is unchanged. - Removed the "Attempt" field from the details sheet. It was the row's position on the page, not an attempt number. A real one needs the API to return it (CTRL-1974). ## Review instructions 1. Enable the Platform Webhooks feature preview, open an endpoint, and send 7 test events (limited to 10 per minute). 2. Page 1 shows 5 deliveries, Previous is disabled and Next is enabled. Next shows the other 2 and disables Next. Previous goes back to the first 5. 3. On an endpoint with exactly 5 deliveries, both buttons are disabled. 4. In DevTools > Network, set throttling to "Slow 4G" and click Next. Skeleton rows show. Then block the `deliveries` request and click Next. "Failed to retrieve deliveries" shows with a Try again button. Wait 10 seconds: no new `deliveries` requests are sent. Unblock the request and click Try again to load the rows. Also block the request while rows are loaded: they stay, and an "Unable to refresh deliveries" notice appears within about 5 seconds and clears once you unblock. 5. Open the details sheet from the bottom row of page 1. In a second tab, send a test event and wait about 5 seconds. Click Retry delivery in the first tab. A toast and a `POST .../retry` request appear, even though the row has moved off page 1. 6. Set the endpoint URL to `https://httpbin.org/delay/10` and send a test event. While the new row shows `pending` (about 10 seconds), clicking it does nothing. Once it shows `success`, it opens the sheet.
Writing components
Where to create your components
- For components that declare the general structure and layout of a page:
/components/layouts/xxx
- For components that are tightly coupled to a specific interface:
/components/interfaces/xxx
- For components that are meant to be reusable across multiple pages:
/components/ui/xxx
- Note: We're gradually moving files out of the
to-be-cleanedfolder into the respective folders as we refactor
Component structure
- If a component has constants and utility methods that are tightly coupled to itself, keep them close to the component and enclose them in a folder with an
index.tsxas an entry point - Otherwise it can just be a file on its own
- For example:
-
components/ui - SampleComponentA - SampleComponentA.tsx - SampleComponentA.constants.ts - SampleComponentA.utils.ts - SampleComponentA.types.ts - index.ts - SampleComponentB.tsx
-
Template for building components
// Declare the prop types of your component
interface ComponentAProps {
sampleProp: string
}
// Name your component accordingly — use a named export, not a default export
export const ComponentA = ({ sampleProp }: ComponentAProps) => {
return <div>ComponentA: {sampleProp}</div>
}