Failure mode: performance (FM18 family) · Measured: 2026-11-22T16:05:11.180Z
Impact: opening the dashboard as Maya (Northlake Studio, about 33 invoices) fires 77 API requests and takes 278 ms on localhost with zero network latency. The request count grows by two for every invoice the agency has ever issued.
Method
- The production build (
pnpm before:build) served on 127.0.0.1:4101, the backend (localbase) on 127.0.0.1:4102 with the demo seed. - Playwright chromium signs in as maya@northlake.example through the login form, then for each run: open
/, reset the backend request log (DELETE /_localbase/log), do a full page load of the target page, wait for the table rows and network idle, readGET /_localbase/log. - "Wall time" = last backend response finished minus navigation start. "Sum of server time" = time the backend spent inside the requests. Three runs each; the summary uses the median.
- Localhost has no network latency. On a real connection each of these sequential requests also pays a round trip (often 50-150 ms to a hosted Supabase region), so the same page takes several seconds.
Dashboard (/dashboard)
| Run | API requests | CORS preflights | Total HTTP | Wall time to last response | Sum of server time |
|---|---|---|---|---|---|
| 1 | 77 | 43 | 120 | 380 ms | 139 ms |
| 2 | 77 | 0 | 77 | 278 ms | 108 ms |
| 3 | 77 | 0 | 77 | 262 ms | 103 ms |
Requests in run 1, grouped:
| Request | Count |
|---|---|
GET /rest/v1/invoice_items | 35 |
GET /rest/v1/clients | 35 |
GET /rest/v1/memberships | 2 |
GET /rest/v1/organizations | 2 |
GET /rest/v1/invoices | 1 |
GET /rest/v1/projects | 1 |
POST /rest/v1/rpc/get_org_revenue | 1 |
Invoice list (/invoices)
| Run | API requests | CORS preflights | Total HTTP | Wall time to last response | Sum of server time |
|---|---|---|---|---|---|
| 1 | 75 | 0 | 75 | 258 ms | 95 ms |
| 2 | 75 | 41 | 116 | 500 ms | 93 ms |
| 3 | 75 | 0 | 75 | 232 ms | 85 ms |
Requests in run 1, grouped:
| Request | Count |
|---|---|
GET /rest/v1/invoice_items | 35 |
GET /rest/v1/clients | 35 |
GET /rest/v1/memberships | 2 |
GET /rest/v1/organizations | 2 |
GET /rest/v1/invoices | 1 |
Why
src/hooks/useInvoices.ts loads every invoice (select=*, no limit, no pagination), then loops over them and awaits two more requests per invoice: invoice_items?invoice_id=eq.<id> and clients?id=eq.<id>. The loop is sequential, so the latency adds up. Totals are then re-summed in the browser from float dollars. CORS preflights (OPTIONS) are counted separately in the tables; in this setup Chromium sent none, so every row above is a real query.
One embedded select (invoices?select=id,number,status,total,client:clients(name)&limit=25) or a server-side endpoint returns the same screen in one request.