Skip to content

Commit b0fc42d

Browse files
Debounce checkLoginState to prevent unexpected redirection during testing (#9012) (#9016)
(cherry picked from commit e93b969) Co-authored-by: Dean <me@dgardiner.net>
1 parent 9938498 commit b0fc42d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/frontend/src/pages/Auth/Logged-In.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Trans } from '@lingui/macro';
22
import { Card, Container, Group, Loader, Stack, Text } from '@mantine/core';
3+
import { useDebouncedCallback } from '@mantine/hooks';
34
import { useEffect } from 'react';
45
import { useLocation, useNavigate } from 'react-router-dom';
56

@@ -9,8 +10,10 @@ export default function Logged_In() {
910
const navigate = useNavigate();
1011
const location = useLocation();
1112

13+
const checkLoginStateDebounced = useDebouncedCallback(checkLoginState, 300);
14+
1215
useEffect(() => {
13-
checkLoginState(navigate, location?.state);
16+
checkLoginStateDebounced(navigate, location?.state);
1417
}, [navigate]);
1518

1619
return (

0 commit comments

Comments
 (0)