mirror of
https://github.com/ansible/awx.git
synced 2026-02-24 06:26:00 -03:30
Remove useMemo from session context
This commit is contained in:
@@ -94,7 +94,7 @@ const ProtectedRoute = ({ children, ...rest }) => {
|
|||||||
{children}
|
{children}
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
</Route>
|
</Route>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (authRedirectTo !== null) setAuthRedirectTo(pathname);
|
if (authRedirectTo !== null) setAuthRedirectTo(pathname);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import React, {
|
import React, {
|
||||||
useContext,
|
useContext,
|
||||||
useEffect,
|
useEffect,
|
||||||
useMemo,
|
|
||||||
useState,
|
useState,
|
||||||
useRef,
|
useRef,
|
||||||
useCallback,
|
useCallback,
|
||||||
@@ -128,27 +127,19 @@ function SessionProvider({ children }) {
|
|||||||
clearInterval(sessionIntervalId.current);
|
clearInterval(sessionIntervalId.current);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const value = useMemo(
|
|
||||||
() => ({
|
|
||||||
logout,
|
|
||||||
authRedirectTo,
|
|
||||||
setAuthRedirectTo,
|
|
||||||
handleSessionContinue,
|
|
||||||
sessionCountdown,
|
|
||||||
isSessionExpired,
|
|
||||||
}),
|
|
||||||
[
|
|
||||||
logout,
|
|
||||||
authRedirectTo,
|
|
||||||
setAuthRedirectTo,
|
|
||||||
handleSessionContinue,
|
|
||||||
sessionCountdown,
|
|
||||||
isSessionExpired,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SessionContext.Provider value={value}>{children}</SessionContext.Provider>
|
<SessionContext.Provider
|
||||||
|
value={{
|
||||||
|
authRedirectTo,
|
||||||
|
handleSessionContinue,
|
||||||
|
isSessionExpired,
|
||||||
|
logout,
|
||||||
|
sessionCountdown,
|
||||||
|
setAuthRedirectTo,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</SessionContext.Provider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ const Login = styled(PFLogin)`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
function AWXLogin({ alt, i18n, isAuthenticated }) {
|
function AWXLogin({ alt, isAuthenticated }) {
|
||||||
const { authRedirectTo, isSessionExpired, setAuthRedirectTo } = useSession();
|
const { authRedirectTo, isSessionExpired, setAuthRedirectTo } = useSession();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|||||||
Reference in New Issue
Block a user