diff --git a/web/src/views/Settings/TwoFactorAuthentication/WebauthnDevices.tsx b/web/src/views/Settings/TwoFactorAuthentication/WebauthnDevices.tsx index b6b99d150..f66f45b9c 100644 --- a/web/src/views/Settings/TwoFactorAuthentication/WebauthnDevices.tsx +++ b/web/src/views/Settings/TwoFactorAuthentication/WebauthnDevices.tsx @@ -1,6 +1,18 @@ import React, { useEffect, useState } from "react"; -import { Box, Button, Paper, Stack, Table, TableBody, TableCell, TableHead, TableRow, Typography } from "@mui/material"; +import { + Box, + Button, + Paper, + Skeleton, + Stack, + Table, + TableBody, + TableCell, + TableHead, + TableRow, + Typography, +} from "@mui/material"; import { useTranslation } from "react-i18next"; import { useNavigate } from "react-router-dom"; @@ -24,6 +36,7 @@ export default function TwoFactorAuthSettings(props: Props) { const { createInfoNotification, createErrorNotification } = useNotifications(); const [webauthnShowDetails, setWebauthnShowDetails] = useState(-1); const [registrationInProgress, setRegistrationInProgress] = useState(false); + const [ready, setReady] = useState(false); const [webauthnDevices, setWebauthnDevices] = useState(); @@ -31,6 +44,7 @@ export default function TwoFactorAuthSettings(props: Props) { (async function () { const devices = await getWebauthnDevices(); setWebauthnDevices(devices); + setReady(true); })(); }, []); @@ -83,34 +97,43 @@ export default function TwoFactorAuthSettings(props: Props) { {"Add new device"} - {webauthnDevices ? ( - - - - - - {translate("Name")} - {translate("Enabled")} - {translate("Actions")} - - - - {webauthnDevices.map((x, idx) => { - return ( - - ); - })} - -
-
- ) : null} + + {ready ? ( + <> + {webauthnDevices ? ( + + + + + {translate("Name")} + {translate("Enabled")} + {translate("Actions")} + + + + {webauthnDevices.map((x, idx) => { + return ( + + ); + })} + +
+ ) : null} + + ) : ( + <> + + + + )} +