ui: fix session search on url change
This commit is contained in:
parent
2aaafa5b22
commit
7fd741348c
2 changed files with 5 additions and 11 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
import withSiteIdUpdater from 'HOCs/withSiteIdUpdater';
|
import withSiteIdUpdater from 'HOCs/withSiteIdUpdater';
|
||||||
import withSiteIdUpdater from 'HOCs/withSiteIdUpdater';
|
|
||||||
import React, { Suspense, lazy } from 'react';
|
import React, { Suspense, lazy } from 'react';
|
||||||
import { Redirect, Route, Switch } from 'react-router-dom';
|
import { Redirect, Route, Switch } from 'react-router-dom';
|
||||||
import { observer } from 'mobx-react-lite';
|
import { observer } from 'mobx-react-lite';
|
||||||
|
|
@ -10,7 +9,7 @@ import { Loader } from 'UI';
|
||||||
|
|
||||||
import APIClient from './api_client';
|
import APIClient from './api_client';
|
||||||
import * as routes from './routes';
|
import * as routes from './routes';
|
||||||
import { debounce } from '@/utils';
|
import { debounceCall } from '@/utils';
|
||||||
|
|
||||||
const components: any = {
|
const components: any = {
|
||||||
SessionPure: lazy(() => import('Components/Session/Session')),
|
SessionPure: lazy(() => import('Components/Session/Session')),
|
||||||
|
|
@ -88,7 +87,6 @@ const ASSIST_PATH = routes.assist();
|
||||||
const LIVE_SESSION_PATH = routes.liveSession();
|
const LIVE_SESSION_PATH = routes.liveSession();
|
||||||
const MULTIVIEW_PATH = routes.multiview();
|
const MULTIVIEW_PATH = routes.multiview();
|
||||||
const MULTIVIEW_INDEX_PATH = routes.multiviewIndex();
|
const MULTIVIEW_INDEX_PATH = routes.multiviewIndex();
|
||||||
const ASSIST_STATS_PATH = routes.assistStats();
|
|
||||||
|
|
||||||
const USABILITY_TESTING_PATH = routes.usabilityTesting();
|
const USABILITY_TESTING_PATH = routes.usabilityTesting();
|
||||||
const USABILITY_TESTING_EDIT_PATH = routes.usabilityTestingEdit();
|
const USABILITY_TESTING_EDIT_PATH = routes.usabilityTestingEdit();
|
||||||
|
|
@ -99,7 +97,6 @@ const SPOT_PATH = routes.spot();
|
||||||
const SCOPE_SETUP = routes.scopeSetup();
|
const SCOPE_SETUP = routes.scopeSetup();
|
||||||
|
|
||||||
const HIGHLIGHTS_PATH = routes.highlights();
|
const HIGHLIGHTS_PATH = routes.highlights();
|
||||||
let debounceSearch: any = () => {};
|
|
||||||
|
|
||||||
function PrivateRoutes() {
|
function PrivateRoutes() {
|
||||||
const { projectsStore, userStore, integrationsStore, searchStore } = useStore();
|
const { projectsStore, userStore, integrationsStore, searchStore } = useStore();
|
||||||
|
|
@ -124,13 +121,9 @@ function PrivateRoutes() {
|
||||||
}
|
}
|
||||||
}, [siteId]);
|
}, [siteId]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
debounceSearch = debounce(() => searchStore.fetchSessions(), 250);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (!searchStore.urlParsed) return;
|
if (!searchStore.urlParsed) return;
|
||||||
debounceSearch();
|
debounceCall(() => searchStore.fetchSessions(true), 250)()
|
||||||
}, [searchStore.urlParsed, searchStore.instance.filters, searchStore.instance.eventsOrder]);
|
}, [searchStore.urlParsed, searchStore.instance.filters, searchStore.instance.eventsOrder]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -394,10 +394,11 @@ class SearchStore {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetchSessions(
|
fetchSessions = async (
|
||||||
force: boolean = false,
|
force: boolean = false,
|
||||||
bookmarked: boolean = false,
|
bookmarked: boolean = false,
|
||||||
): Promise<void> {
|
): Promise<void> => {
|
||||||
|
console.log(this.searchInProgress)
|
||||||
if (this.searchInProgress) return;
|
if (this.searchInProgress) return;
|
||||||
const filter = this.instance.toSearch();
|
const filter = this.instance.toSearch();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue