Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/smooth-lobsters-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fix show correct user roles after updating user roles on admin edit user panel.
10 changes: 8 additions & 2 deletions apps/meteor/client/views/admin/users/AdminUserFormWithData.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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 (
Expand All @@ -42,7 +48,7 @@ const AdminUserFormWithData = ({ uid, onReload }: AdminUserFormWithDataProps): R
);
}

return <AdminUserForm userData={data?.user} onReload={onReload} />;
return <AdminUserForm userData={data?.user} onReload={handleReload} />;
};

export default AdminUserFormWithData;