Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Fix EmailDetails global loading state hide (#541)

Leendert de Borst9151e504bc93
diff --git a/browser-extensions/chrome/src/app/pages/EmailDetails.tsx b/browser-extensions/chrome/src/app/pages/EmailDetails.tsx
index 11aeed8c7..bf728cc0d 100644
--- a/browser-extensions/chrome/src/app/pages/EmailDetails.tsx
+++ b/browser-extensions/chrome/src/app/pages/EmailDetails.tsx
@@ -7,6 +7,8 @@ import LoadingSpinner from '../components/LoadingSpinner';
import { useMinDurationLoading } from '../hooks/useMinDurationLoading';
import EncryptionUtility from '../../shared/EncryptionUtility';
import { Attachment } from '../../shared/types/webapi/Attachment';
+import { useLoading } from '../context/LoadingContext';
+
/**
* Email details page.
*/
@@ -18,6 +20,16 @@ const EmailDetails: React.FC = () => {
const [error, setError] = useState<string | null>(null);
const [email, setEmail] = useState<Email | null>(null);
const [isLoading, setIsLoading] = useMinDurationLoading(true, 150);
+ const { setIsInitialLoading } = useLoading();
+
+ /**
+ * Make sure the initial loading state is set to false when this component is loaded itself.
+ */
+ useEffect(() => {
+ if (!isLoading) {
+ setIsInitialLoading(false);
+ }
+ }, [setIsInitialLoading, isLoading]);
useEffect(() => {
// For popup windows, ensure we have proper history state for navigation