Something went wrong. Try again.
Bluesky app fork with some witchin' additions 💫
Something went wrong. Try again.
440 B · 18 lines
TypeScript
at prod
12345678910111213141516171819import {useEffect} from 'react'
import {type DialogControlProps} from '#/components/Dialog/types'
export function useAutoOpen(control: DialogControlProps, showTimeout?: number) { useEffect(() => { if (showTimeout) { const timeout = setTimeout(() => { control.open() }, showTimeout) return () => { clearTimeout(timeout) } } else { control.open() } }, [control, showTimeout])}