Files
webstudio/packages
Ivan Starkov f60b9bddb1 chore: Remove single() PostgREST calls from Build to improve compression (#3969)
## Description

[Discussion Link](https://github.com/orgs/supabase/discussions/28757)

To reduce traffic size, temporarily remove the `.single()` call from the
“Build” table until the issue under discussion is resolved.

## Test:

### Logs with `.single()` call:

Notice that the `content-encoding` header is null.

<img width="992" alt="image"
src="https://github.com/user-attachments/assets/86438c2f-53f0-47ee-9fe9-b44716425bb2">

[View
Logs](https://vercel.com/getwebstudio/webstudio-builder/9ua91vyJRZbQQyyJoLXEEEBiWtrE/logs?slug=app-future&slug=en-US&slug=getwebstudio&slug=webstudio-builder&slug=9ua91vyJRZbQQyyJoLXEEEBiWtrE&slug=logs&page=1&timeline=past30Minutes&startDate=1724132921408&endDate=1724134721408&searchQuery=%3D%3D%3D%3D%3D%3DENCODING%20IS%3D)

### Logs without `.single()` call:

Here, the `content-encoding` header is `null` only for Build `update`
requests; everything else has `br` encoding.

<img width="967" alt="image"
src="https://github.com/user-attachments/assets/c899086a-a175-4761-874b-62626ecd0671">

[View
Logs](https://vercel.com/getwebstudio/webstudio-builder/EdRGvZRBKBJbT4Wzp2AnYFCkSYgg/logs?slug=app-future&slug=en-US&slug=getwebstudio&slug=webstudio-builder&slug=EdRGvZRBKBJbT4Wzp2AnYFCkSYgg&slug=logs&page=1&timeline=past30Minutes&startDate=1724133136494&endDate=1724134936494&searchQuery=%3D%3D%3D%3D%3D%3DENCODING%20IS%3D%3D%3D&selectedLogId=1724134923767492376713800000&selectedLogTimestamp=1724134923767&forceEndDate=1724134923859)

_See commits for how to add logs:_

```ts
async fetch(input: string | URL | globalThis.Request, init?: RequestInit) {
  const res = await fetch(input, init);

  if (typeof input === "string" || input instanceof URL) {
    const url = new URL(input);

    if (url.pathname.endsWith("/Build")) {
      console.info(
        "======ENCODING IS=====",
        res.headers.get("content-encoding")
      );
    }
  }

  return res;
},
```
2024-08-20 13:26:25 +03:00
..
2024-08-01 18:12:13 +02:00
2024-08-10 01:21:18 +03:00