diff --git a/ts/components/registration/RegistrationStages.tsx b/ts/components/registration/RegistrationStages.tsx
index 0031f11a4..cfde41466 100644
--- a/ts/components/registration/RegistrationStages.tsx
+++ b/ts/components/registration/RegistrationStages.tsx
@@ -72,7 +72,12 @@ export const RegistrationStages = () => {
{step === Onboarding.Start ? : null}
{step === Onboarding.CreateAccount ? : null}
diff --git a/ts/components/registration/hooks/index.tsx b/ts/components/registration/hooks/index.tsx
index 55e9d89ee..e6479d74e 100644
--- a/ts/components/registration/hooks/index.tsx
+++ b/ts/components/registration/hooks/index.tsx
@@ -31,6 +31,7 @@ type UseRecoveryProgressEffectProps = {
*/
export const useRecoveryProgressEffect = (props: UseRecoveryProgressEffectProps) => {
const { step, progress, setProgress, ourPubkey, displayName } = props;
+ const totalProgress = 100;
const dispatch = useDispatch();
@@ -38,18 +39,22 @@ export const useRecoveryProgressEffect = (props: UseRecoveryProgressEffectProps)
await setSignWithRecoveryPhrase(true);
await registrationDone(ourPubkey, displayName);
- window.log.debug(`WIP: [onboarding] restore account: loggin in for ${displayName}`);
+ window.log.debug(`WIP: [onboarding] restore account: logging in for ${displayName}`);
trigger('openInbox');
}, [displayName, ourPubkey]);
useEffect(() => {
if (step === AccountRestoration.Loading) {
interval = setInterval(() => {
- if (progress < 100) {
+ window.log.debug(
+ `WIP: [onboarding] restore account: progress ${progress} state ${AccountRestoration[step]}`
+ );
+
+ if (progress < totalProgress) {
dispatch(setProgress(progress + 1));
}
- if (progress >= 100) {
+ if (progress >= totalProgress) {
clearInterval(interval);
// if we didn't get the display name in time, we need to enter it manually
window.log.debug(
@@ -57,20 +62,20 @@ export const useRecoveryProgressEffect = (props: UseRecoveryProgressEffectProps)
);
dispatch(setAccountRestorationStep(AccountRestoration.DisplayName));
}
- }, ONBOARDING_TIMES.RECOVERY_TIMEOUT / 100);
+ }, ONBOARDING_TIMES.RECOVERY_TIMEOUT / totalProgress);
}
if (step === AccountRestoration.Finishing) {
interval = setInterval(() => {
- if (progress < 100) {
+ if (progress < totalProgress) {
dispatch(setProgress(progress + 1));
}
- if (progress >= 100) {
+ if (progress >= totalProgress) {
clearInterval(interval);
dispatch(setAccountRestorationStep(AccountRestoration.Finished));
}
- }, ONBOARDING_TIMES.RECOVERY_FINISHING / 100);
+ }, ONBOARDING_TIMES.RECOVERY_FINISHING / totalProgress);
}
if (step === AccountRestoration.Finished) {
diff --git a/ts/components/registration/stages/CreateAccount.tsx b/ts/components/registration/stages/CreateAccount.tsx
index 58bb0514f..cb720218f 100644
--- a/ts/components/registration/stages/CreateAccount.tsx
+++ b/ts/components/registration/stages/CreateAccount.tsx
@@ -103,8 +103,8 @@ export const CreateAccount = () => {
window.log.debug(
`WIP: [onboarding] create account: creation failed! Error: ${e.message || e}`
);
- dispatch(setDisplayNameError(e.message || String(e)));
dispatch(setAccountCreationStep(AccountCreation.DisplayName));
+ dispatch(setDisplayNameError(e.message || String(e)));
}
};
diff --git a/ts/components/registration/stages/RestoreAccount.tsx b/ts/components/registration/stages/RestoreAccount.tsx
index 22205ae94..5bcf33acd 100644
--- a/ts/components/registration/stages/RestoreAccount.tsx
+++ b/ts/components/registration/stages/RestoreAccount.tsx
@@ -182,6 +182,7 @@ export const RestoreAccount = () => {
window.log.debug(
`WIP: [onboarding] restore account: recoverAndEnterDisplayName() is starting recoveryPassword: ${recoveryPassword} displayName: ${displayName}`
);
+ dispatch(setProgress(0));
await signInWithNewDisplayName({
displayName,
recoveryPassword,
@@ -191,8 +192,8 @@ export const RestoreAccount = () => {
window.log.debug(
`WIP: [onboarding] restore account: restoration with new display name failed! Error: ${e.message || e}`
);
- dispatch(setDisplayNameError(e.message || String(e)));
dispatch(setAccountRestorationStep(AccountRestoration.DisplayName));
+ dispatch(setDisplayNameError(e.message || String(e)));
}
};