2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-28 03:26:45 +00:00

Debounce checkLoginState to prevent unexpected redirection during testing (#9012) (#9016)

(cherry picked from commit e93b9692a1c149f6caca84291dba5be067f5b539)

Co-authored-by: Dean <me@dgardiner.net>
This commit is contained in:
github-actions[bot] 2025-02-03 08:03:40 +11:00 committed by GitHub
parent 993849813f
commit b0fc42d906
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,6 @@
import { Trans } from '@lingui/macro';
import { Card, Container, Group, Loader, Stack, Text } from '@mantine/core';
import { useDebouncedCallback } from '@mantine/hooks';
import { useEffect } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';
@ -9,8 +10,10 @@ export default function Logged_In() {
const navigate = useNavigate();
const location = useLocation();
const checkLoginStateDebounced = useDebouncedCallback(checkLoginState, 300);
useEffect(() => {
checkLoginState(navigate, location?.state);
checkLoginStateDebounced(navigate, location?.state);
}, [navigate]);
return (