mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-30 20:55:42 +00:00 
			
		
		
		
	Debounce checkLoginState to prevent unexpected redirection during testing (#9012)
				
					
				
			This commit is contained in:
		| @@ -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 ( | ||||
|   | ||||
		Reference in New Issue
	
	Block a user