ui: fix fresh sessions lookup

This commit is contained in:
nick-delirium 2025-03-27 10:57:37 +01:00
parent 20b938365c
commit cb4bf932c4
No known key found for this signature in database
GPG key ID: 93ABD695DF5FDBA0
3 changed files with 19 additions and 9 deletions

View file

@ -23,9 +23,7 @@ function LatestSessionsMessage() {
{t('Show')} {numberWithCommas(count)} {t('New')}{' '}
{count > 1 ? t('Sessions') : t('Session')}
</div>
) : (
<></>
);
) : null;
}
export default observer(LatestSessionsMessage);

View file

@ -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 {

View file

@ -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() {