Files
supabase/apps/studio/hooks/misc/useDebouncedValue.ts
Charis c0c824809e feat(studio): add infinite pagination for buckets policies (#41277)
## Summary of changes

Buckets policies page at /project/_/storage/files/policies now uses the
paginated buckets endpoint to fetch buckets.

## Before

Used a non-paginated query.

## After

To support a paginated query, we now have:
- Infinite scroll loading behavior
- Fixed some of the buckets utilities to account for policy references
to buckets that haven't loaded yet
2025-12-11 15:45:16 -05:00

17 lines
325 B
TypeScript

import { useState } from 'react'
import { useDebounce } from 'react-use'
export const useDebouncedValue = (value: string, delay: number) => {
const [debouncedValue, setDebouncedValue] = useState(value)
useDebounce(
() => {
setDebouncedValue(value)
},
delay,
[value]
)
return debouncedValue
}