-
Notifications
You must be signed in to change notification settings - Fork 3
Change mnemonic save screen to be similar to MetaMask. #179
base: dev
Are you sure you want to change the base?
Conversation
setMnemonicArr((mnemonic as string).split(" ")); | ||
const sortedMnemonic = (mnemonic as string).split(" ").sort(); | ||
setMnemonic((await getProtocolOptIn().getMnemonic()) as string); | ||
const sortedMnemonic = mnemonic.split(" ").sort(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mnemonic
value in here won't be updated from the setMnemonic
call on the previous line. If you override the variable with the result of the getMnemonic
call, then you won't need to run this effect multiple times.
setPageOverride( | ||
<SetupSuccess | ||
mnemonic={mnemonic as string} | ||
onContinue={() => setPageOverride(null)} | ||
/>, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't have this component do the first showing of the SetupSuccess
screen. I would have this only show that if the user clicks to see the mnemonic again or fails.
|
||
const [counter, setCounter] = React.useState(0); | ||
export function EnsureUserSavedMnemonic(props: { onComplete: () => void }) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the logic for this component is getting complex enough to warrant extracting a (unit tested) class to manage this state. Could either be functional (as in returns a new instance each time a mutation happens) or could have a subscription for when mutations happen that triggers a re-render.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Misclicked.
No description provided.