diff --git a/native/account/registration/missing-registration-data/missing-registration-data-handler.react.js b/native/account/registration/missing-registration-data/missing-registration-data-handler.react.js --- a/native/account/registration/missing-registration-data/missing-registration-data-handler.react.js +++ b/native/account/registration/missing-registration-data/missing-registration-data-handler.react.js @@ -36,12 +36,17 @@ ); const dispatch = useDispatch(); + const lastAlertInfo = React.useRef(createSIWEBAckupMessageAlertInfo); + React.useEffect(() => { + lastAlertInfo.current = createSIWEBAckupMessageAlertInfo; + }, [createSIWEBAckupMessageAlertInfo]); + React.useEffect(() => { if ( !loggedIn || accountHasPassword(currentUserInfo) || cachedSelections.siweBackupSecrets || - shouldSkipCreateSIWEBackupMessageAlert(createSIWEBAckupMessageAlertInfo) + shouldSkipCreateSIWEBackupMessageAlert(lastAlertInfo.current) ) { return; } @@ -55,7 +60,10 @@ const nativeSIWEBackupSecrets = await commCoreModule.getSIWEBackupSecrets(); - if (nativeSIWEBackupSecrets) { + if ( + nativeSIWEBackupSecrets || + shouldSkipCreateSIWEBackupMessageAlert(lastAlertInfo.current) + ) { return; } @@ -67,6 +75,10 @@ alertType: alertTypes.SIWE_BACKUP_MESSAGE, time: Date.now(), }; + lastAlertInfo.current = { + totalAlerts: lastAlertInfo.current.totalAlerts + 1, + lastAlertTime: payload.time, + }; dispatch({ type: recordAlertActionType, @@ -76,7 +88,6 @@ }, [ cachedSelections.siweBackupSecrets, checkIfPrimaryDevice, - createSIWEBAckupMessageAlertInfo, currentUserInfo, dispatch, loggedIn,