Skip to content

Commit

Permalink
feat(seed-recovery): empty textarea after valid submission
Browse files Browse the repository at this point in the history
  • Loading branch information
gergold committed Apr 21, 2022
1 parent 6270c8d commit 15279a3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/extension/src/ui/screens/SeedRecoveryScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, useMemo, useState } from "react"
import { FC, useMemo, useState, useRef } from "react"

import { BackButton } from "../components/BackButton"
import { TextArea } from "../components/InputText"
Expand All @@ -10,6 +10,7 @@ import { validateAndSetSeedPhrase } from "../states/seedRecover"
import { ConfirmScreen } from "./ConfirmScreen"

export const SeedRecoveryScreen: FC = () => {
const textAreaElement = useRef<HTMLTextAreaElement>(null);
const [seedPhraseInput, setSeedPhraseInput] = useState("")
const [error, setError] = useState("")
const customNavigate = useCustomNavigate()
Expand All @@ -21,6 +22,9 @@ export const SeedRecoveryScreen: FC = () => {
const handleRestoreClick = async () => {
try {
validateAndSetSeedPhrase(seedPhraseInput)
if (textAreaElement.current !== null) {
textAreaElement.current.value = ""
}
customNavigate(routes.seedRecoveryPassword())
} catch {
setError("Invalid seed phrase")
Expand All @@ -45,6 +49,7 @@ export const SeedRecoveryScreen: FC = () => {
space
</P>
<TextArea
ref={textAreaElement}
placeholder="Enter the 12 words"
value={seedPhraseInput}
onChange={(e: any) => {
Expand All @@ -54,6 +59,7 @@ export const SeedRecoveryScreen: FC = () => {
style={{
margin: "40px 0 8px",
}}
autoComplete="off"
/>
{error && <FormError>{error}</FormError>}
<A
Expand Down

0 comments on commit 15279a3

Please sign in to comment.