mirror of
https://github.com/supabase/supabase.git
synced 2026-06-12 17:27:58 +08:00
## 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
29 lines
944 B
TypeScript
29 lines
944 B
TypeScript
import { createContext, useContext, useState, type ReactNode } from 'react'
|
|
|
|
const MainScrollContainerContext = createContext<HTMLElement | null>(null)
|
|
const SetMainScrollContainerContext = createContext<
|
|
React.Dispatch<React.SetStateAction<HTMLElement | null>>
|
|
>(() => {})
|
|
|
|
export const MainScrollContainerProvider = ({ children }: { children: ReactNode }) => {
|
|
const [container, setContainer] = useState<HTMLElement | null>(null)
|
|
|
|
return (
|
|
<MainScrollContainerContext.Provider value={container}>
|
|
<SetMainScrollContainerContext.Provider value={setContainer}>
|
|
{children}
|
|
</SetMainScrollContainerContext.Provider>
|
|
</MainScrollContainerContext.Provider>
|
|
)
|
|
}
|
|
|
|
export const useSetMainScrollContainer = () => {
|
|
const context = useContext(SetMainScrollContainerContext)
|
|
return context
|
|
}
|
|
|
|
export const useMainScrollContainer = () => {
|
|
const context = useContext(MainScrollContainerContext)
|
|
return context
|
|
}
|