Files
supabase/apps/studio/components/interfaces/Storage
Drew McLellan 07dbe3ce1d fix(studio): use raw object count as storage pagination offset (#52706)
## Problem

Studio Storage hides `.emptyFolderPlaceholder` objects after listing a
folder, but `fetchMoreFolderContents` calculated the next page offset
from the number of visible items. When a page includes the placeholder,
the API returns 200 objects but Studio keeps 199, so the next request
uses offset 199 instead of 200 and the last file of the previous page
appears twice. The duplicates compound with every further page.

Fixes FE-4843. Closes #52607.

Before:
<img width="521" height="458" alt="Screenshot 2026-11-03 at 14 51 09"
src="https://github.com/user-attachments/assets/1ed20ded-08c6-4c56-92d7-5c97ef82cd00"
/>

After:
<img width="532" height="460" alt="Screenshot 2026-11-03 at 14 53 58"
src="https://github.com/user-attachments/assets/64891f27-7fa0-44cb-8076-39b405df0ee4"
/>



## Solution

Each storage column now records `hiddenItemsCount`, the number of API
objects hidden from the visible list (the placeholder).
`fetchMoreFolderContents` offsets the next page by `items.length +
hiddenItemsCount`.

Because the offset is still derived from `items.length`, local edits to
a column (creating a folder, uploads, deletes, renames) keep it in step
with the server, as they did before.

Added tests to `state/storage-explorer.test.ts`: a folder with a
placeholder plus 300 files lists each file exactly once and requests
offsets 0 and 200, and a folder without a placeholder still pages at 0,
200, 400. Reverting the offset line makes the placeholder test fail.

## Review instructions

1. In a bucket, create a `docs` folder and, using the Storage API,
upload a zero-byte `docs/.emptyFolderPlaceholder` plus files
`file-000.txt` through `file-299.txt`.
2. Open `docs` in Studio and sort by Name ascending.
3. Scroll to load further pages and check the list requests in the
network tab: offsets should be 0 and 200, and no file should appear
twice.
4. Run `pnpm --filter studio exec vitest run
state/storage-explorer.test.ts`.

## Checklist

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill (not applicable)
2026-11-03 16:26:23 +00:00
..