From 663d82417ca687d70ce9ab2ac96ceebd1302d041 Mon Sep 17 00:00:00 2001 From: ren <18050944+renintw@users.noreply.github.com> Date: Wed, 7 Jun 2023 07:47:42 +0800 Subject: [PATCH] Always initialize "hasBackupCodesPrinted" as true in Manage component --- settings/src/components/backup-codes.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/settings/src/components/backup-codes.js b/settings/src/components/backup-codes.js index cdc24b64..0ad6ec5c 100644 --- a/settings/src/components/backup-codes.js +++ b/settings/src/components/backup-codes.js @@ -186,6 +186,11 @@ function Manage( { setRegenerating } ) { setHasBackupCodesPrinted, }, } = useContext( GlobalContext ); + + // In Manage screen, always initialize "hasBackupCodesPrinted" as true. + // Otherwise, if users leave the account screen and return, it would default back to false, and the 'Back' button would be unclickable. + useEffect( () => setHasBackupCodesPrinted( true ), [] ); + const remaining = record[ '2fa_backup_codes_remaining' ]; return (