mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
[BUGFIX] Fix re-rendering callbacks (#1445)
b34b10322b
introduced a regression where including deps in the associated useCallback functions would cause React to re-render components.
This resulted in unexpected symptoms like multiple Duo push requests, even if a successful or errored request had already been received.
Empty deps/no re-rendering for the respective callbacks is an expected result therefore we can safely ignore these issues the linter is suggesting needs to be fixed.
This commit is contained in:
parent
2b1baacd82
commit
2834f3f8e8
|
@ -31,8 +31,10 @@ const OneTimePasswordMethod = function (props: Props) {
|
|||
const redirectionURL = useRedirectionURL();
|
||||
|
||||
const { onSignInSuccess, onSignInError } = props;
|
||||
const onSignInErrorCallback = useCallback(onSignInError, [onSignInError]);
|
||||
const onSignInSuccessCallback = useCallback(onSignInSuccess, [onSignInSuccess]);
|
||||
/* eslint-disable react-hooks/exhaustive-deps */
|
||||
const onSignInErrorCallback = useCallback(onSignInError, []);
|
||||
const onSignInSuccessCallback = useCallback(onSignInSuccess, []);
|
||||
/* eslint-enable react-hooks/exhaustive-deps */
|
||||
|
||||
const signInFunc = useCallback(async () => {
|
||||
if (props.authenticationLevel === AuthenticationLevel.TwoFactor) {
|
||||
|
|
|
@ -30,8 +30,10 @@ const PushNotificationMethod = function (props: Props) {
|
|||
const mounted = useIsMountedRef();
|
||||
|
||||
const { onSignInSuccess, onSignInError } = props;
|
||||
const onSignInErrorCallback = useCallback(onSignInError, [onSignInError]);
|
||||
const onSignInSuccessCallback = useCallback(onSignInSuccess, [onSignInSuccess]);
|
||||
/* eslint-disable react-hooks/exhaustive-deps */
|
||||
const onSignInErrorCallback = useCallback(onSignInError, []);
|
||||
const onSignInSuccessCallback = useCallback(onSignInSuccess, []);
|
||||
/* eslint-enable react-hooks/exhaustive-deps */
|
||||
|
||||
const signInFunc = useCallback(async () => {
|
||||
if (props.authenticationLevel === AuthenticationLevel.TwoFactor) {
|
||||
|
|
|
@ -38,8 +38,10 @@ const SecurityKeyMethod = function (props: Props) {
|
|||
const [timerPercent, triggerTimer,] = useTimer(signInTimeout * 1000 - 500);
|
||||
|
||||
const { onSignInSuccess, onSignInError } = props;
|
||||
const onSignInErrorCallback = useCallback(onSignInError, [onSignInError]);
|
||||
const onSignInSuccessCallback = useCallback(onSignInSuccess, [onSignInSuccess]);
|
||||
/* eslint-disable react-hooks/exhaustive-deps */
|
||||
const onSignInErrorCallback = useCallback(onSignInError, []);
|
||||
const onSignInSuccessCallback = useCallback(onSignInSuccess, []);
|
||||
/* eslint-enable react-hooks/exhaustive-deps */
|
||||
|
||||
const doInitiateSignIn = useCallback(async () => {
|
||||
// If user is already authenticated, we don't initiate sign in process.
|
||||
|
|
Loading…
Reference in New Issue
Block a user