diff --git a/src/view/com/modals/AddAppPasswords.tsx b/src/view/com/modals/AddAppPasswords.tsx index 5048a004..040d294b 100644 --- a/src/view/com/modals/AddAppPasswords.tsx +++ b/src/view/com/modals/AddAppPasswords.tsx @@ -62,7 +62,8 @@ export function Component({}: {}) { const {_} = useLingui() const {closeModal} = useModalControls() const {data: passwords} = useAppPasswordsQuery() - const createMutation = useAppPasswordCreateMutation() + const {mutateAsync: mutateAppPassword, isPending} = + useAppPasswordCreateMutation() const [name, setName] = useState( shadesOfBlue[Math.floor(Math.random() * shadesOfBlue.length)], ) @@ -107,7 +108,7 @@ export function Component({}: {}) { } try { - const newPassword = await createMutation.mutateAsync({name}) + const newPassword = await mutateAppPassword({name}) if (newPassword) { setAppPassword(newPassword.password) } else { @@ -136,6 +137,17 @@ export function Component({}: {}) { } } + const textInputRef = React.useCallback((node: TextInput | null) => { + if (!node) { + return + } + + // `selectTextOnFocus` isn't working with `autoFocus={true}` or without a timeout going. + setTimeout(() => { + node.focus() + }, 0) + }, []) + return ( @@ -145,6 +157,7 @@ export function Component({}: {}) { Please enter a unique name for this App Password or use our randomly generated one. + asdq42 ) : ( @@ -159,6 +172,7 @@ export function Component({}: {}) { {!appPassword ? (