Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fix

Manav Rathie6b4d220a338
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();