From dbdaa9d7ec4e9a9632e4fa6ffea1a4366f641ebb Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Wed, 18 Feb 2026 20:14:04 +0100 Subject: [PATCH] Remove unused useIsPageVisible hook and adjust event fetching to only occur on initial mount --- web/hooks/use-events.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/web/hooks/use-events.ts b/web/hooks/use-events.ts index 05f104d..9f90517 100644 --- a/web/hooks/use-events.ts +++ b/web/hooks/use-events.ts @@ -2,7 +2,6 @@ import {useEffect, useState} from 'react' import {api} from 'web/lib/api' -import {useIsPageVisible} from './use-page-visible' export type Event = { id: string @@ -37,7 +36,6 @@ export const useEvents = () => { const [events, setEvents] = useState(null) const [loading, setLoading] = useState(true) const [error, setError] = useState(null) - const isPageVisible = useIsPageVisible() const fetchEvents = async (showLoading = true) => { try { @@ -54,11 +52,9 @@ export const useEvents = () => { } useEffect(() => { - // console.debug({isPageVisible}) - if (isPageVisible) { - fetchEvents() - } - }, [isPageVisible]) + // Only fetch on initial mount, not on page visibility changes + fetchEvents() + }, []) const refetch = () => fetchEvents(false)