mirror of
https://github.com/supabase/supabase.git
synced 2026-07-06 19:44:24 +08:00
* Move all studio files from /studio to /apps/studio. * Move studio specific prettier ignores. * Fix the ui references from studio. * Fix the css imports. * Fix all package.json issues. * Fix the prettier setup for the studio app. * Add .turbo folder to prettierignore. * Fix the github workflows.
19 lines
605 B
TypeScript
19 lines
605 B
TypeScript
import { fillTimeseries } from 'components/interfaces/Settings/Logs'
|
|
import { useMemo } from 'react'
|
|
|
|
/**
|
|
* Convenience hook for memoized filling of timeseries data.
|
|
*/
|
|
const useFillTimeseriesSorted = (...args: Parameters<typeof fillTimeseries>) => {
|
|
return useMemo(() => {
|
|
const [data, timestampKey] = args
|
|
if (!data[0]?.[timestampKey]) return data
|
|
|
|
const filled = fillTimeseries(...args)
|
|
return filled.sort((a, b) => {
|
|
return (new Date(a[args[1]]) as any) - (new Date(b[args[1]]) as any)
|
|
})
|
|
}, [JSON.stringify(args[0]), ...args])
|
|
}
|
|
export default useFillTimeseriesSorted
|