Skip to content

Commit

Permalink
HMS-2151 fix: remember settings on step-back to token page
Browse files Browse the repository at this point in the history
If the user steps back to the token page, settings they provided in
the later pages of wizard are forgotten.

Avoid this by updating `onVerify` to return early if it detects that
the registered state is already `'completed'`.  This avoid
overwriting the domain in the wizard state with the "pristine"
domain data from the `VerifyRegistry` component.
  • Loading branch information
frasertweedale committed Oct 13, 2023
1 parent 7c1aa29 commit f1b0737
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Routes/WizardPage/WizardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ const WizardPage = () => {
};

const onVerify = (value: VerifyState, data?: Domain) => {
if (appContext.wizard.getRegisteredStatus() === 'completed') {
// verify was previously completed (e.g. user stepped the wizard
// back to the token page. Do not overwrite the domain value,
// so that we do not discard any user-specified settings.
return;
}
appContext.wizard.setRegisteredStatus(value);
if (value === 'completed') {
data && appContext.wizard.setDomain(data);
Expand Down

0 comments on commit f1b0737

Please sign in to comment.