ui: refetch live session list on proj change
This commit is contained in:
parent
73fff8b817
commit
048ae0913c
2 changed files with 11 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue