diff --git a/src/main/webapp/src/hooks/useLoading.jsx b/src/main/webapp/src/hooks/useLoading.jsx index f438387..d236898 100644 --- a/src/main/webapp/src/hooks/useLoading.jsx +++ b/src/main/webapp/src/hooks/useLoading.jsx @@ -1,4 +1,4 @@ -import {createContext, useContext, useState} from "react"; +import {createContext, useContext, useEffect, useState} from "react"; import './useLoading.css' import {FallingLines} from "react-loader-spinner"; @@ -28,9 +28,22 @@ export function LoadingProvider({children}) { function LoadingOverLay() { const showOverlay = useLoading() + const [realShow, setRealShow] = useState(showOverlay) - if (showOverlay) { - return
+ useEffect(() => { + if (showOverlay === 0) { + setRealShow(showOverlay) + return + } + + const timer = setTimeout(() => { + setRealShow(showOverlay) + }, 100) + return () => clearTimeout(timer) + }, [showOverlay]); + + if (realShow) { + return
{ e.stopPropagation() }}> @@ -40,4 +53,4 @@ function LoadingOverLay() { } else { return <> } -} \ No newline at end of file +}