EditProfile: do not mutate contact

Fixes urbit/landscape#698
This commit is contained in:
Liam Fitzgerald 2021-04-06 11:43:58 +10:00
parent 264fce214b
commit 067991533a
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB

View File

@ -93,9 +93,6 @@ export function EditProfile(props: any): ReactElement {
};
const history = useHistory();
if (contact) {
contact.isPublic = isPublic;
}
const onSubmit = async (values: any, actions: any) => {
try {
@ -143,7 +140,7 @@ export function EditProfile(props: any): ReactElement {
<>
<Formik
validationSchema={formSchema}
initialValues={contact || emptyContact}
initialValues={{...contact, isPublic } || emptyContact}
onSubmit={onSubmit}
>
{({ setFieldValue }) => (