Files
supabase/apps/studio/hooks/misc/useInterval.ts
Crispy c69ac64ad5 docs: update custom domain docs for verification process (#29344)
* docs: update custom domain docs for verification process

* fix: ensure the ui experience for custom domains matches the flow

* chore: prettier formatting fixes

* docs: only reference a single txt record for custom domains

* fix: drop undefined from dns table type

* automatically poll for custom domain ssl status

* Minor UI tweaks

---------

Co-authored-by: Alaister Young <a@alaisteryoung.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-09-26 16:55:36 +08:00

24 lines
447 B
TypeScript

import { useEffect, useRef } from 'react'
export function useInterval(callback: () => void, delay: number | false) {
const savedCallback = useRef(callback)
useEffect(() => {
savedCallback.current = callback
}, [callback])
useEffect(() => {
if (delay === false) {
return
}
const id = setInterval(() => {
savedCallback.current()
}, delay)
return () => {
clearInterval(id)
}
}, [delay])
}