From e6b4d220a3385438738ffcf26a19dfd806739f5c Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Fri, 21 Jun 2024 16:09:16 +0530 Subject: [PATCH] Fix --- .../photos/src/components/AuthenticateUserModal.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/web/apps/photos/src/components/AuthenticateUserModal.tsx b/web/apps/photos/src/components/AuthenticateUserModal.tsx index e0762c3b1f..3bf9911e80 100644 --- a/web/apps/photos/src/components/AuthenticateUserModal.tsx +++ b/web/apps/photos/src/components/AuthenticateUserModal.tsx @@ -9,7 +9,7 @@ import { LS_KEYS, getData } from "@ente/shared/storage/localStorage"; import type { KeyAttributes, User } from "@ente/shared/user/types"; import { t } from "i18next"; import { AppContext } from "pages/_app"; -import { useCallback, useContext, useEffect, useState } from "react"; +import { useContext, useEffect, useState, useCallback } from "react"; interface Iprops { open: boolean; @@ -43,6 +43,7 @@ export default function AuthenticateUserModal({ try { const session = await checkSessionValidity(); if (session.status != "valid") { + onClose(); setDialogBoxAttributesV2( dismissableSessionExpiredDialogAttributes(logout), ); @@ -73,7 +74,6 @@ export default function AuthenticateUserModal({ } else { setKeyAttributes(keyAttributes); } - await validateSession(); } catch (e) { log.error("AuthenticateUserModal initialization failed", e); onClose(); @@ -83,6 +83,12 @@ export default function AuthenticateUserModal({ main(); }, []); + useEffect(() => { + // Do a non-blocking validation of the session, but show the dialog to + // the user. + if (open) void validateSession(); + }, [open]); + const useMasterPassword: VerifyMasterPasswordFormProps["callback"] = async () => { onClose();