diff --git a/frontend/app/PrivateRoutes.tsx b/frontend/app/PrivateRoutes.tsx index aacb1b133..9169d9344 100644 --- a/frontend/app/PrivateRoutes.tsx +++ b/frontend/app/PrivateRoutes.tsx @@ -125,13 +125,13 @@ function PrivateRoutes() { }, [siteId]); React.useEffect(() => { - debounceSearch = debounce(() => searchStore.fetchSessions(), 500); + debounceSearch = debounce(() => searchStore.fetchSessions(), 250); }, []); React.useEffect(() => { if (!searchStore.urlParsed) return; debounceSearch(); - }, [searchStore.instance.filters, searchStore.instance.eventsOrder]); + }, [searchStore.urlParsed, searchStore.instance.filters, searchStore.instance.eventsOrder]); return ( }> diff --git a/frontend/app/components/shared/LiveSessionList/LiveSessionList.tsx b/frontend/app/components/shared/LiveSessionList/LiveSessionList.tsx index 3a599dfdf..35350d69a 100644 --- a/frontend/app/components/shared/LiveSessionList/LiveSessionList.tsx +++ b/frontend/app/components/shared/LiveSessionList/LiveSessionList.tsx @@ -64,12 +64,6 @@ function LiveSessionList() { void searchStoreLive.fetchSessions(); }; - useEffect(() => { - if (projectsStore.activeSiteId) { - void searchStoreLive.fetchSessions(true); - } - }, [projectsStore.activeSiteId]) - const onUserClick = (userId: string, userAnonymousId: string) => { if (userId) { searchStoreLive.addFilterByKeyAndValue(FilterKey.USERID, userId); diff --git a/frontend/app/components/shared/LiveSessionSearch/LiveSessionSearch.tsx b/frontend/app/components/shared/LiveSessionSearch/LiveSessionSearch.tsx index c6faa550b..a2b694b61 100644 --- a/frontend/app/components/shared/LiveSessionSearch/LiveSessionSearch.tsx +++ b/frontend/app/components/shared/LiveSessionSearch/LiveSessionSearch.tsx @@ -9,8 +9,10 @@ function LiveSessionSearch() { const appliedFilter = searchStoreLive.instance; useEffect(() => { - void searchStoreLive.fetchSessions(); - }, []); + if (projectsStore.activeSiteId) { + void searchStoreLive.fetchSessions(true); + } + }, [projectsStore.activeSiteId]) const onAddFilter = (filter: any) => { filter.autoOpen = true; diff --git a/frontend/app/components/shared/SessionFilters/SessionFilters.tsx b/frontend/app/components/shared/SessionFilters/SessionFilters.tsx index 3046404cd..a4f060426 100644 --- a/frontend/app/components/shared/SessionFilters/SessionFilters.tsx +++ b/frontend/app/components/shared/SessionFilters/SessionFilters.tsx @@ -53,9 +53,6 @@ function SessionFilters() { onBeforeLoad: async () => { await reloadTags(); }, - onLoaded: () => { - debounceFetch = debounce(() => searchStore.fetchSessions(), 500); - } }); const onAddFilter = (filter: any) => { diff --git a/frontend/app/hooks/useSessionSearchQueryHandler.ts b/frontend/app/hooks/useSessionSearchQueryHandler.ts index c6a1c6dfd..02dd88b72 100644 --- a/frontend/app/hooks/useSessionSearchQueryHandler.ts +++ b/frontend/app/hooks/useSessionSearchQueryHandler.ts @@ -49,13 +49,8 @@ const useSessionSearchQueryHandler = ({ searchStore.applyFilter(filter, true); } - // Important: Mark URL as parsed BEFORE fetching - // This prevents the initial fetch when the URL is parsed searchStore.setUrlParsed(); - - // Then fetch sessions - this is the only place that should fetch initially - await searchStore.fetchSessions(); - onLoaded(); + onLoaded?.(); } catch (error) { console.error('Error applying filter from query:', error); searchStore.setUrlParsed(); diff --git a/frontend/app/layout/SideMenu.tsx b/frontend/app/layout/SideMenu.tsx index 28df5adfe..c57b8561f 100644 --- a/frontend/app/layout/SideMenu.tsx +++ b/frontend/app/layout/SideMenu.tsx @@ -255,7 +255,7 @@ function SideMenu(props: Props) { {t('Beta')}