Updating language in settings needs a reload to be translated (#4431)

Co-authored-by: gitstart <gitstart@users.noreply.github.com>
Co-authored-by: Nitesh Singh <nitesh.singh@gitstart.dev>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>
Co-authored-by: Grace Nshokano <grace.devolop@gmail.com>
Co-authored-by: Matheus Muniz <87545749+matheusmuniz03@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
pull/4354/head^2
GitStart 2022-09-14 10:28:23 +01:00 committed by GitHub
parent c09107cec8
commit 01e0fed3c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -40,6 +40,7 @@ const GeneralQueryView = (props: inferSSRProps<typeof getServerSideProps>) => {
const GeneralView = ({ localeProp, t, user }: GeneralViewProps) => {
const router = useRouter();
const utils = trpc.useContext();
// const { data: user, isLoading } = trpc.useQuery(["viewer.me"]);
const mutation = trpc.useMutation("viewer.updateProfile", {
@ -49,6 +50,9 @@ const GeneralView = ({ localeProp, t, user }: GeneralViewProps) => {
onError: () => {
showToast(t("error_updating_settings"), "error");
},
onSettled: async () => {
await utils.invalidateQueries(["viewer.public.i18n"]);
},
});
const localeOptions = useMemo(() => {