2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-28 11:36:44 +00:00

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

This commit is contained in:
Dean 2025-02-03 09:37:15 +13:00 committed by GitHub
parent 2a6434ead8
commit e93b9692a1
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 (