mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2026-04-13 08:00:30 +08:00
fix: auto-refresh relative time on profiles page
This commit is contained in:
parent
9bbb495dae
commit
31bec33064
@ -59,6 +59,7 @@ const Profiles: React.FC = () => {
|
||||
const [updating, setUpdating] = useState(false)
|
||||
const [fileOver, setFileOver] = useState(false)
|
||||
const [url, setUrl] = useState('')
|
||||
const [, setNow] = useState(new Date())
|
||||
const isUrlEmpty = url.trim() === ''
|
||||
const sensors = useSensors(useSensor(PointerSensor))
|
||||
const { data: subs = [], mutate: mutateSubs } = useSWR(
|
||||
@ -218,6 +219,11 @@ const Profiles: React.FC = () => {
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
const timer = setInterval(() => setNow(new Date()), 30000)
|
||||
return () => clearInterval(timer)
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
setSortedItems(items)
|
||||
}, [items])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user