From db43289d71e86b1ec6072db8359b0ba05faf17c2 Mon Sep 17 00:00:00 2001
From: Nate Kelley <133379588+nate-kelley-buster@users.noreply.github.com>
Date: Wed, 22 Jan 2025 15:11:07 -0800
Subject: [PATCH] refetch after user default access changed (#58)
---
.../users/[userId]/_overview/UserDefaultAccess.tsx | 14 ++++++++------
.../[userId]/_overview/UserOverviewController.tsx | 4 ++--
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/web/src/app/app/settings/users/[userId]/_overview/UserDefaultAccess.tsx b/web/src/app/app/settings/users/[userId]/_overview/UserDefaultAccess.tsx
index d91d582f4..929944e23 100644
--- a/web/src/app/app/settings/users/[userId]/_overview/UserDefaultAccess.tsx
+++ b/web/src/app/app/settings/users/[userId]/_overview/UserDefaultAccess.tsx
@@ -4,14 +4,16 @@ import { Text, Title } from '@/components/text';
import { Card, Select } from 'antd';
import { useMemoizedFn } from 'ahooks';
-export const UserDefaultAccess: React.FC<{ user: OrganizationUser; isAdmin: boolean }> = ({
- user,
- isAdmin
-}) => {
+export const UserDefaultAccess: React.FC<{
+ user: OrganizationUser;
+ isAdmin: boolean;
+ refetchUser: () => void;
+}> = ({ user, isAdmin, refetchUser }) => {
const { mutateAsync, isPending } = useUpdateUser();
- const onChange = useMemoizedFn((value: string) => {
- mutateAsync({ userId: user.id, role: value as OrganizationUser['role'] });
+ const onChange = useMemoizedFn(async (value: string) => {
+ await mutateAsync({ userId: user.id, role: value as OrganizationUser['role'] });
+ refetchUser();
});
return (
diff --git a/web/src/app/app/settings/users/[userId]/_overview/UserOverviewController.tsx b/web/src/app/app/settings/users/[userId]/_overview/UserOverviewController.tsx
index 45c221586..241c66de0 100644
--- a/web/src/app/app/settings/users/[userId]/_overview/UserOverviewController.tsx
+++ b/web/src/app/app/settings/users/[userId]/_overview/UserOverviewController.tsx
@@ -8,14 +8,14 @@ import { UserLineageHeader } from './UserLineageHeader';
import { UserDatasetSearch } from './UserDatasetSearch';
export const UserOverviewController = React.memo(({ userId }: { userId: string }) => {
- const { data: user } = useGetUser({ userId });
+ const { data: user, refetch: refetchUser } = useGetUser({ userId });
const isAdmin = useUserConfigContextSelector((x) => x.isAdmin);
if (!user) return null;
return (
<>
-
+
>