From 1d7a71b6401a398bf452fbdf05a40435b9fdb3ce Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Thu, 7 Dec 2023 16:58:53 +0100 Subject: [PATCH] fix(ui) uxt fixes --- .../components/UsabilityTesting/LiveTestsModal.tsx | 11 ++++++++--- .../app/components/shared/SessionItem/SessionItem.tsx | 2 +- frontend/app/mstore/uxtestingStore.ts | 3 --- tracker/tracker/package.json | 2 +- tracker/tracker/src/main/app/index.ts | 5 ++++- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/frontend/app/components/UsabilityTesting/LiveTestsModal.tsx b/frontend/app/components/UsabilityTesting/LiveTestsModal.tsx index b15bee809..2be830c1c 100644 --- a/frontend/app/components/UsabilityTesting/LiveTestsModal.tsx +++ b/frontend/app/components/UsabilityTesting/LiveTestsModal.tsx @@ -2,13 +2,14 @@ import React from 'react'; import { useStore } from 'App/mstore'; import { numberWithCommas } from 'App/utils'; import { Input } from 'antd'; -import ReloadButton from "Shared/ReloadButton"; +import ReloadButton from 'Shared/ReloadButton'; import SessionItem from 'Shared/SessionItem'; import { Pagination } from 'UI'; import { observer } from 'mobx-react-lite'; -function LiveTestsModal({ testId, closeModal }: { testId: string, closeModal: () => void }) { +function LiveTestsModal({ testId, closeModal }: { testId: string; closeModal: () => void }) { const [page, setPage] = React.useState(1); + const [isLoading, setIsLoading] = React.useState(false); const [userId, setUserId] = React.useState(''); const { uxtestingStore } = useStore(); @@ -17,8 +18,12 @@ function LiveTestsModal({ testId, closeModal }: { testId: string, closeModal: () }, []); const refreshData = (page: number) => { + setIsLoading(true); setPage(page); - uxtestingStore.getAssistSessions(testId, page, userId); + uxtestingStore + .getAssistSessions(testId, page, userId) + .then(() => setIsLoading(false)) + .catch(() => setIsLoading(false)); }; return ( diff --git a/frontend/app/components/shared/SessionItem/SessionItem.tsx b/frontend/app/components/shared/SessionItem/SessionItem.tsx index c8bf537cb..a8d794979 100644 --- a/frontend/app/components/shared/SessionItem/SessionItem.tsx +++ b/frontend/app/components/shared/SessionItem/SessionItem.tsx @@ -252,7 +252,7 @@ function SessionItem(props: RouteComponentProps & Props) { )} -
{live ? : formattedDuration}
+
{live || props.live ? : formattedDuration}
diff --git a/frontend/app/mstore/uxtestingStore.ts b/frontend/app/mstore/uxtestingStore.ts index cba6f8f56..25f02bd40 100644 --- a/frontend/app/mstore/uxtestingStore.ts +++ b/frontend/app/mstore/uxtestingStore.ts @@ -247,14 +247,11 @@ export default class UxtestingStore { }; getAssistSessions = async (testId: string, page: number, userId?: string) => { - this.setLoading(true); try { const sessions = await this.client.fetchTestSessions(testId, page, 10, true, userId); this.setAssistSessions(sessions); } catch (e) { console.error(e); - } finally { - this.setLoading(false); } }; diff --git a/tracker/tracker/package.json b/tracker/tracker/package.json index 9e29003dd..55bd8efed 100644 --- a/tracker/tracker/package.json +++ b/tracker/tracker/package.json @@ -1,7 +1,7 @@ { "name": "@openreplay/tracker", "description": "The OpenReplay tracker main package", - "version": "11.0.1-19", + "version": "11.0.1-20", "keywords": [ "logging", "replay" diff --git a/tracker/tracker/src/main/app/index.ts b/tracker/tracker/src/main/app/index.ts index 7d495efaf..33c9f728f 100644 --- a/tracker/tracker/src/main/app/index.ts +++ b/tracker/tracker/src/main/app/index.ts @@ -708,7 +708,9 @@ export default class App { } this.restartAttempts = 0 - this.uxtManager = new UserTestManager(this, uxtStorageKey) + this.uxtManager = this.uxtManager + ? this.uxtManager + : new UserTestManager(this, uxtStorageKey) let uxtId: number | undefined const savedUxtTag = this.localStorage.getItem(uxtStorageKey) if (savedUxtTag) { @@ -721,6 +723,7 @@ export default class App { uxtId = qId ? parseInt(qId, 10) : undefined } } + if (uxtId && !this.uxtManager.isActive) { this.uxtManager.getTest(uxtId, token, Boolean(savedUxtTag)) }