fix: no client context on ModifyAccount

fix: no reactivity on account settings

closes #706
fixes #683
fixes #702
This commit is contained in:
Paul Makles 2022-06-21 10:57:58 +01:00
parent aa9974149c
commit cb0a521473
3 changed files with 7 additions and 6 deletions

2
external/lang vendored

@ -1 +1 @@
Subproject commit ae44e2b179789b363792240c16856d1215bd4221
Subproject commit 50838167d7d253de9d08715e6a6070c3ddc9fcc2

View file

@ -1,5 +1,6 @@
import { At } from "@styled-icons/boxicons-regular";
import { Envelope, Key, Pencil } from "@styled-icons/boxicons-solid";
import { observer } from "mobx-react-lite";
import { Text } from "preact-i18n";
import { useContext, useEffect, useState } from "preact/hooks";
@ -11,7 +12,6 @@ import {
HiddenValue,
} from "@revoltchat/ui";
import { useIntermediate } from "../../../context/intermediate/Intermediate";
import { modalController } from "../../../context/modals";
import {
ClientStatus,
@ -19,10 +19,9 @@ import {
useClient,
} from "../../../context/revoltjs/RevoltClient";
export default function EditAccount() {
export default observer(() => {
const client = useClient();
const status = useContext(StatusContext);
const { openScreen } = useIntermediate();
const [email, setEmail] = useState("...");
@ -74,4 +73,4 @@ export default function EditAccount() {
))}
</>
);
}
});

View file

@ -7,6 +7,8 @@ import { Category, Error, Modal } from "@revoltchat/ui";
import { noopTrue } from "../../../lib/js";
import { useApplicationState } from "../../../mobx/State";
import FormField from "../../../pages/login/FormField";
import { AppContext } from "../../revoltjs/RevoltClient";
import { takeError } from "../../revoltjs/util";
@ -27,7 +29,7 @@ export default function ModifyAccount({
field,
...props
}: ModalProps<"modify_account">) {
const client = useContext(AppContext);
const client = useApplicationState().client!;
const [processing, setProcessing] = useState(false);
const { handleSubmit, register, errors } = useForm<FormInputs>();
const [error, setError] = useState<string | undefined>(undefined);