mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 09:55:06 +03:00
## Context Renaming folders on the Storage Explorer has a tendency to be flaky as we're using the `POST /objects/move` storage API to move files to the renamed folder which handles one file per request. For a big folder (e.g 100+ files), users will easily hit rate limits and run into 429s with the API, in which the current behaviour just shows toast errors as the error handler, leaving an odd state upon running through every file in the folder where some files are in the old folder, and others in the new one ## Changes involved Main solution is to implement an automatic retry logic for `renameFolder`, but changes involved are: - Remove batching logic for renaming folders (Which fires `n` requests per batch) - The batch logic was negligible anyways since our batch size was only 2 😅 - Instead we now handle moving of files sequentially - If a file runs into an error during the `POST` request, retry the request after `n` seconds - If the error was a 429, retry after 60 seconds, otherwise just 5 seconds - Will attempt the request for a total of 3 times - Toast progress description will also be updated to show the message (timer will also count down to keep the UI interactive and not look stuck) <img width="362" height="98" alt="image" src="https://github.com/user-attachments/assets/52ba685a-2f35-42f1-8fcf-98351184fd56" /> - After the whole process is completed, if any file ran into an error, toast description will add a CTA to retry the rename ## Demo https://github.com/user-attachments/assets/d65b3c22-f9f8-4984-9521-6fc83a69f82e ## To test Have a folder in your project's storage bucket with 100+ files (can stress test with nested folders) - [ ] Verify that you can rename the folder, and the dashboard automatically handles errors
Supabase UI Package
Figma-tokens setup
Tokens setup is based partly on blogpost on the Mirahi Digital Garden.
Transforms tokens stored on Figma Tokens using token-transformer and Style Dictionary to css-variables with references, and use them in your TailwindCSS environment with multiple themes.
Build all the styles files (css-variables and tailwind config)
npm run build-styles
This creates a directory called styles with the tokens and also CSS required.
Other examples
You can find other examples here by Jan Six
Adding new themes/sets
Add new sets by extending the scripts in package.json. Currently theme sets derive from exported/[set name] but can come from anywhere.
Adding a new set can be done with the following:
// package.json
//..
"build-transform-light": "npx token-transformer tokens.json styles/tokens/02_themes/light.json global,exported/light,theme global",
// add a new line like this:
"build-transform-new": "npx token-transformer tokens.json styles/tokens/02_themes/new.json global,new,theme global",
//..
// append the new theme/set command to end of the build-transform command
"build-transform": "npm run build-transform-global && npm run build-transform-typography && npm run build-transform-dark && npm run build-transform-light && npm run build-transform-new",