Files
Joshen LimandAlaister Young 8b5a087eb7 Joshen/depr 262 bucketid route needs to handle if a bucket doesnt exist (#40430)
* Handle landing on a bucket id that doesnt exist in project

* Standardize re routing behaviour for files bucket

* refactor

---------

Co-authored-by: Alaister Young <a@alaisteryoung.com>
2025-11-14 15:25:59 +08:00

16 lines
329 B
TypeScript

import { useParams } from 'common'
import { useBucketsQuery } from 'data/storage/buckets-query'
export const useSelectedBucket = () => {
const { ref, bucketId } = useParams()
return useBucketsQuery(
{ projectRef: ref },
{
select(data) {
return data.find((b) => b.id === bucketId)
},
}
)
}