ui: minor session list fixes

This commit is contained in:
nick-delirium 2025-03-27 10:43:25 +01:00
parent 8e68ebd52b
commit 20b938365c
No known key found for this signature in database
GPG key ID: 93ABD695DF5FDBA0
5 changed files with 10 additions and 21 deletions

View file

@ -47,26 +47,18 @@ function LiveSessionList() {
const _filter = { ...filter };
let shouldUpdate = false;
// Set default sort if not already set
if (sortOptions[1] && !filter.sort) {
_filter.sort = sortOptions[1].value;
shouldUpdate = true;
}
// Only update filters if there's a change
if (shouldUpdate) {
searchStoreLive.edit(_filter);
}
// Start auto-refresh timeout
timeout();
// Cleanup on component unmount or re-run
return () => {
clearTimeout(timeoutId);
};
}, [metaListLoading, filter.sort]); // Add necessary dependencies
}, [metaListLoading, filter.sort]);
const refetch = () => {
void searchStoreLive.fetchSessions();
@ -172,7 +164,6 @@ function LiveSessionList() {
</Button>
</div>
}
// image={<img src="/assets/img/live-sessions.png" style={{ width: '70%', marginBottom: '30px' }} />}
show={!loading && list.length === 0}
>
<div>

View file

@ -55,11 +55,6 @@ function SessionList() {
const hasNoRecordings = !activeSite || !activeSite.recorded;
const metaList = customFieldStore.list;
useEffect(() => {
if (!searchStore.urlParsed) return;
void searchStore.checkForLatestSessionCount();
}, [location.pathname]);
const NO_CONTENT = React.useMemo(() => {
if (isBookmark && !isEnterprise) {
return {

View file

@ -25,7 +25,7 @@ function SessionTags() {
const activeTab = searchStore.activeTags;
React.useEffect(() => {
searchStore.toggleTag(types.ALL);
searchStore.resetTags();
}, [projectsStore.activeSiteId])
return (

View file

@ -205,6 +205,10 @@ class SearchStore {
});
}
resetTags = () => {
this.activeTags = ['all'];
}
toggleTag(tag?: iTag) {
if (!tag) {
this.activeTags = [];

View file

@ -288,10 +288,7 @@ export default class SessionStore {
params.order = params.order === 'asc' ? 'desc' : 'asc';
}
const data: any = await sessionService.getLiveSessions(params);
this.liveSessions = data.sessions.map(
(session: any) => new Session({ ...session, live: true }),
);
this.totalLiveSessions = data.total;
this.customSetSessions(data);
} catch (e) {
console.error(e);
} finally {
@ -603,7 +600,9 @@ export default class SessionStore {
};
customSetSessions = (data: any) => {
this.liveSessions = data.sessions.map((s: any) => new Session(s));
this.liveSessions = data.sessions.map(
(session: any) => new Session({ ...session, live: true }),
);
this.totalLiveSessions = data.total;
};