ui: fix fresh sessions lookup
This commit is contained in:
parent
20b938365c
commit
cb4bf932c4
3 changed files with 19 additions and 9 deletions
|
|
@ -23,9 +23,7 @@ function LatestSessionsMessage() {
|
|||
{t('Show')} {numberWithCommas(count)} {t('New')}{' '}
|
||||
{count > 1 ? t('Sessions') : t('Session')}
|
||||
</div>
|
||||
) : (
|
||||
<></>
|
||||
);
|
||||
) : null;
|
||||
}
|
||||
|
||||
export default observer(LatestSessionsMessage);
|
||||
|
|
|
|||
|
|
@ -38,13 +38,10 @@ function SessionList() {
|
|||
} = useStore();
|
||||
const { isEnterprise } = userStore;
|
||||
const { isLoggedIn } = userStore;
|
||||
const { list } = sessionStore;
|
||||
const { lastPlayedSessionId } = sessionStore;
|
||||
const { lastPlayedSessionId, list, total } = sessionStore;
|
||||
const loading = sessionStore.loadingSessions;
|
||||
const { total } = sessionStore;
|
||||
const onToggleFavorite = sessionStore.toggleFavorite;
|
||||
const { siteId } = projectsStore;
|
||||
const { updateProjectRecordingStatus } = projectsStore;
|
||||
const { updateProjectRecordingStatus, siteId, previousSiteid } = projectsStore;
|
||||
const { currentPage, activeTab, pageSize } = searchStore;
|
||||
const { filters } = searchStore.instance;
|
||||
const _filterKeys = filters.map((i: any) => i.key);
|
||||
|
|
@ -55,6 +52,11 @@ function SessionList() {
|
|||
const hasNoRecordings = !activeSite || !activeSite.recorded;
|
||||
const metaList = customFieldStore.list;
|
||||
|
||||
useEffect(() => {
|
||||
if (!searchStore.urlParsed || siteId !== previousSiteid) return;
|
||||
void searchStore.checkForLatestSessionCount();
|
||||
}, [location.pathname]);
|
||||
|
||||
const NO_CONTENT = React.useMemo(() => {
|
||||
if (isBookmark && !isEnterprise) {
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { makeAutoObservable, runInAction } from 'mobx';
|
||||
import { makeAutoObservable, runInAction, reaction } from 'mobx';
|
||||
import {
|
||||
GLOBAL_HAS_NO_RECORDINGS,
|
||||
SITE_ID_STORAGE_KEY,
|
||||
|
|
@ -20,6 +20,7 @@ export default class ProjectsStore {
|
|||
instance: Project | null = null;
|
||||
|
||||
siteId: string | null = null;
|
||||
previousSiteid: string | null = null;
|
||||
|
||||
active: Project | null = null;
|
||||
|
||||
|
|
@ -37,6 +38,15 @@ export default class ProjectsStore {
|
|||
const storedSiteId = localStorage.getItem(SITE_ID_STORAGE_KEY);
|
||||
this.siteId = storedSiteId ?? null;
|
||||
makeAutoObservable(this);
|
||||
|
||||
reaction(
|
||||
() => this.activeSiteId,
|
||||
(_, prevId) => {
|
||||
if (prevId) {
|
||||
this.previousSiteid = prevId;
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
get isMobile() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue