mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 15:39:13 +00:00
## Problem Deleting a bucket from its own page (`/storage/files/buckets/[bucketId]`) could leave Studio on the deleted bucket's route. The page kept loading and then showed "Failed to fetch buckets" / "Bucket not found". On success, `DeleteBucketModal` called `onClose()` and then `router.push` to the buckets list. On the bucket page, `onClose` clears the `?delete` query param through nuqs, which queues its own shallow push to the current bucket URL. That push could race with the navigation to the list and land back on the deleted bucket. The page then re-rendered with the bucket query already removed from the cache, refetched the missing bucket, and got a 404. ## Solution - On the bucket's own page, the success handler now awaits `router.push` to the buckets list and does not call `onClose`. The modal closes when the page unmounts. When there is no `bucketId` in the route, it still calls `onClose` as before. - Added a component test for deleting from the bucket page. It checks that Studio ends up on `/project/<ref>/storage/files` and that `onClose` is not called. The test opts out of the global `useParams` stub so the modal reads `bucketId` from the mocked route. It fails without the fix. ## How to verify 1. Open a project, go to Storage > Files, and open any bucket. 2. Choose Edit bucket > Delete bucket, type the bucket name, and confirm. 3. Studio shows the success toast and lands on the buckets list (`/project/<ref>/storage/files`). The deleted bucket no longer appears there. 4. Studio never shows the deleted bucket's page with a spinner that keeps loading, "Failed to fetch buckets" or "Bucket not found". ## Checks run - `pnpm --filter studio exec vitest run components/interfaces/Storage/FilesBuckets/DeleteBucketModal.test.tsx` (2 passed) - `pnpm turbo run typecheck --filter='...[origin/master]'` - `pnpm turbo run lint --filter='[origin/master]'` - Prettier check on the changed files [FE-4926](https://linear.app/supabase/issue/FE-4926/deleting-a-bucket-leaves-its-page-loading-until-an-error) --------- Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>