mirror of
https://github.com/supabase/supabase.git
synced 2026-05-08 01:40:13 -04:00
8e705ecdbc
Exporting all rows (in CSV, SQL, or JSON format) currently uses offset pagination, which can cause performance problems if the table is large. There is also a correctness problem if the table is being actively updated as the export happens, because the relative row offsets could shift between queries. Now that composite filters are available in postgres-meta, we can change to using cursor pagination on the primary key (or any non-null unique keys) wherever possible. Where this is not possible, the user will be shown a confirmation dialog explaining the possible performance impact. --------- Co-authored-by: Ali Waseem <waseema393@gmail.com> Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
16 lines
400 B
TypeScript
16 lines
400 B
TypeScript
import { useCallback, useLayoutEffect, useRef } from 'react'
|
|
|
|
export const useStaticEffectEvent = <Callback extends Function>(callback: Callback) => {
|
|
const callbackRef = useRef(callback)
|
|
|
|
useLayoutEffect(() => {
|
|
callbackRef.current = callback
|
|
})
|
|
|
|
const eventFn = useCallback((...args: any) => {
|
|
return callbackRef.current(...args)
|
|
}, [])
|
|
|
|
return eventFn as unknown as Callback
|
|
}
|