From b0f1a8b942fd0e1619b658c5e0b435bd30828479 Mon Sep 17 00:00:00 2001 From: Vinoth Kumar V <123581387+VinoV1999@users.noreply.github.com> Date: Fri, 26 May 2023 16:08:08 +0530 Subject: [PATCH] fix: update button fix (#9106) * update button fix * Update appearance.tsx * fix linter --------- Co-authored-by: Vinoth Kumar V Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com> Co-authored-by: Peer Richelsen --- apps/web/pages/settings/my-account/appearance.tsx | 4 +++- .../server/routers/loggedInViewer/updateProfile.handler.ts | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/web/pages/settings/my-account/appearance.tsx b/apps/web/pages/settings/my-account/appearance.tsx index cff2e5901d..deadaaaaea 100644 --- a/apps/web/pages/settings/my-account/appearance.tsx +++ b/apps/web/pages/settings/my-account/appearance.tsx @@ -67,12 +67,14 @@ const AppearanceView = () => { const { formState: { isSubmitting, isDirty }, + reset, } = formMethods; const mutation = trpc.viewer.updateProfile.useMutation({ - onSuccess: async () => { + onSuccess: async (data) => { await utils.viewer.me.invalidate(); showToast(t("settings_updated_successfully"), "success"); + reset(data); }, onError: () => { showToast(t("error_updating_settings"), "error"); diff --git a/packages/trpc/server/routers/loggedInViewer/updateProfile.handler.ts b/packages/trpc/server/routers/loggedInViewer/updateProfile.handler.ts index 7d9debf1e4..67983b3b15 100644 --- a/packages/trpc/server/routers/loggedInViewer/updateProfile.handler.ts +++ b/packages/trpc/server/routers/loggedInViewer/updateProfile.handler.ts @@ -137,4 +137,5 @@ export const updateProfileHandler = async ({ ctx, input }: UpdateProfileOptions) .then(() => console.info("Booking pages revalidated")) .catch((e) => console.error(e)); } + return input; };