Spaces:
Paused
Paused
File size: 599 Bytes
92864d8 f854364 92864d8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
"use client"
import { useEffect, useTransition } from "react"
import { usePathname } from "next/navigation"
import { refreshStudio } from "@/server/actions"
export function RefreshStudio() {
const pathname = usePathname()
const [isPending, startTransition] = useTransition()
useEffect(() => {
const slug = `${pathname.split("/").pop()}`
setInterval(() => {
startTransition(() => {
try {
refreshStudio(slug)
} catch (err) {
// ignoring
}
})
}, 2000)
}, [])
// TODO we could display a spinner here
return <></>
} |