mirror of
https://github.com/tale/headplane.git
synced 2026-08-10 05:56:52 +00:00
feat: add machine data
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { useRevalidator } from '@remix-run/react'
|
||||
import { useInterval } from 'usehooks-ts'
|
||||
|
||||
type Properties = {
|
||||
interval: number;
|
||||
}
|
||||
|
||||
export function useLiveData({ interval }: Properties) {
|
||||
const revalidator = useRevalidator()
|
||||
useInterval(() => {
|
||||
if (revalidator.state === 'idle') {
|
||||
revalidator.revalidate()
|
||||
}
|
||||
}, interval)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user