ui: fix double fetches for sessions
This commit is contained in:
parent
6412f14b08
commit
f61c5e99b5
6 changed files with 8 additions and 20 deletions
|
|
@ -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 (
|
||||
<Suspense fallback={<Loader loading className="flex-1" />}>
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -53,9 +53,6 @@ function SessionFilters() {
|
|||
onBeforeLoad: async () => {
|
||||
await reloadTags();
|
||||
},
|
||||
onLoaded: () => {
|
||||
debounceFetch = debounce(() => searchStore.fetchSessions(), 500);
|
||||
}
|
||||
});
|
||||
|
||||
const onAddFilter = (filter: any) => {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ function SideMenu(props: Props) {
|
|||
<Tag
|
||||
color="cyan"
|
||||
bordered={false}
|
||||
className="text-xs"
|
||||
className="text-xs ml-2"
|
||||
>
|
||||
{t('Beta')}
|
||||
</Tag>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue