From b1c03053c74643f1abc2477dee307c8da998caf2 Mon Sep 17 00:00:00 2001 From: yash-rajpal Date: Tue, 25 Jun 2024 22:48:21 +0530 Subject: [PATCH 1/2] refetch user on update --- .../client/views/admin/users/AdminUserFormWithData.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/meteor/client/views/admin/users/AdminUserFormWithData.tsx b/apps/meteor/client/views/admin/users/AdminUserFormWithData.tsx index 63fe2691d9720..e595acc469511 100644 --- a/apps/meteor/client/views/admin/users/AdminUserFormWithData.tsx +++ b/apps/meteor/client/views/admin/users/AdminUserFormWithData.tsx @@ -1,6 +1,7 @@ import type { IUser } from '@rocket.chat/core-typings'; import { isUserFederated } from '@rocket.chat/core-typings'; import { Box, Callout } from '@rocket.chat/fuselage'; +import { useEffectEvent } from '@rocket.chat/fuselage-hooks'; import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ReactElement } from 'react'; import React from 'react'; @@ -16,7 +17,12 @@ type AdminUserFormWithDataProps = { const AdminUserFormWithData = ({ uid, onReload }: AdminUserFormWithDataProps): ReactElement => { const t = useTranslation(); - const { data, isLoading, isError } = useUserInfoQuery({ userId: uid }); + const { data, isLoading, isError, refetch } = useUserInfoQuery({ userId: uid }); + + const handleReload = useEffectEvent(() => { + onReload(); + refetch(); + }); if (isLoading) { return ( @@ -42,7 +48,7 @@ const AdminUserFormWithData = ({ uid, onReload }: AdminUserFormWithDataProps): R ); } - return ; + return ; }; export default AdminUserFormWithData; From 18d63e0b36472b1c1b5daa74ac0239d11aae2195 Mon Sep 17 00:00:00 2001 From: yash-rajpal Date: Tue, 25 Jun 2024 23:43:15 +0530 Subject: [PATCH 2/2] add cs --- .changeset/smooth-lobsters-flash.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/smooth-lobsters-flash.md diff --git a/.changeset/smooth-lobsters-flash.md b/.changeset/smooth-lobsters-flash.md new file mode 100644 index 0000000000000..541d5069ee9c2 --- /dev/null +++ b/.changeset/smooth-lobsters-flash.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': patch +--- + +Fix show correct user roles after updating user roles on admin edit user panel.