ui: refetch live session list on proj change

This commit is contained in:
nick-delirium 2025-03-19 17:36:28 +01:00
parent 73fff8b817
commit 048ae0913c
No known key found for this signature in database
GPG key ID: 93ABD695DF5FDBA0
2 changed files with 11 additions and 2 deletions

View file

@ -19,7 +19,7 @@ const AUTOREFRESH_INTERVAL = 2 * 60 * 1000;
const PER_PAGE = 10;
function LiveSessionList() {
const { searchStoreLive, sessionStore, customFieldStore } = useStore();
const { searchStoreLive, sessionStore, customFieldStore, projectsStore } = useStore();
const filter = searchStoreLive.instance;
const list = sessionStore.liveSessions;
const { totalLiveSessions } = sessionStore;
@ -72,6 +72,12 @@ 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);

View file

@ -248,7 +248,10 @@ class SearchStoreLive {
this.loading = val;
}
fetchSessions = async () => {
fetchSessions = async (force?: boolean) => {
if (!force && this.loading) {
return;
}
this.setLoading(true)
try {
await sessionStore.fetchLiveSessions({