@opexa/portal-components 0.1.70 → 0.1.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -9,7 +9,7 @@ import { useSessionHealthQuery } from '../../client/hooks/useSessionHealthQuery.
|
|
|
9
9
|
import { useSessionQuery } from '../../client/hooks/useSessionQuery.js';
|
|
10
10
|
import { useSignOutMutation } from '../../client/hooks/useSignOutMutation.js';
|
|
11
11
|
import { toaster } from '../../client/utils/toaster.js';
|
|
12
|
-
const SESSION_WATCH_INTERVAL =
|
|
12
|
+
const SESSION_WATCH_INTERVAL = 5_000;
|
|
13
13
|
export function SessionWatcher() {
|
|
14
14
|
const router = useRouter();
|
|
15
15
|
const sessionQuery = useSessionQuery();
|
|
@@ -22,7 +22,6 @@ export function SessionWatcher() {
|
|
|
22
22
|
const refetchSessionHealthRef = useRef(sessionHealthQuery.refetch);
|
|
23
23
|
refetchSessionHealthRef.current = sessionHealthQuery.refetch;
|
|
24
24
|
useEffect(() => {
|
|
25
|
-
let counter = 0;
|
|
26
25
|
let timeout = null;
|
|
27
26
|
let isForeground = true;
|
|
28
27
|
let stopped = false;
|
|
@@ -30,7 +29,6 @@ export function SessionWatcher() {
|
|
|
30
29
|
isForeground = isActive;
|
|
31
30
|
});
|
|
32
31
|
const assignTimeout = () => {
|
|
33
|
-
const duration = counter <= 0 ? SESSION_WATCH_INTERVAL * 1.5 : SESSION_WATCH_INTERVAL;
|
|
34
32
|
return setTimeout(async () => {
|
|
35
33
|
if (isForeground && isAuthenticatedRef.current) {
|
|
36
34
|
try {
|
|
@@ -43,9 +41,8 @@ export function SessionWatcher() {
|
|
|
43
41
|
return;
|
|
44
42
|
}
|
|
45
43
|
}
|
|
46
|
-
counter += 1;
|
|
47
44
|
timeout = assignTimeout();
|
|
48
|
-
},
|
|
45
|
+
}, SESSION_WATCH_INTERVAL);
|
|
49
46
|
};
|
|
50
47
|
timeout = assignTimeout();
|
|
51
48
|
return () => {
|