aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/groups
diff options
context:
space:
mode:
authorViktor Vorona <viktor.vorona@sonarsource.com>2024-02-05 14:21:28 +0100
committersonartech <sonartech@sonarsource.com>2024-02-07 20:02:50 +0000
commit2194a20a846a6aae34acc3e445bf4d58fb7eaad0 (patch)
tree8101fbb62fbc87428d224cfcd9d0a9a17e4be8ea /server/sonar-web/src/main/js/apps/groups
parentf26bae81f1792e329c07f28a1739275d02e4f48a (diff)
downloadsonarqube-2194a20a846a6aae34acc3e445bf4d58fb7eaad0.tar.gz
sonarqube-2194a20a846a6aae34acc3e445bf4d58fb7eaad0.zip
SONAR-21571 Update react-query
Diffstat (limited to 'server/sonar-web/src/main/js/apps/groups')
-rw-r--r--server/sonar-web/src/main/js/apps/groups/components/DeleteGroupForm.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/groups/components/EditMembersModal.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/groups/components/GroupForm.tsx4
3 files changed, 7 insertions, 10 deletions
diff --git a/server/sonar-web/src/main/js/apps/groups/components/DeleteGroupForm.tsx b/server/sonar-web/src/main/js/apps/groups/components/DeleteGroupForm.tsx
index 5b275c2589e..4abc6d4ab07 100644
--- a/server/sonar-web/src/main/js/apps/groups/components/DeleteGroupForm.tsx
+++ b/server/sonar-web/src/main/js/apps/groups/components/DeleteGroupForm.tsx
@@ -31,7 +31,7 @@ interface Props {
export default function DeleteGroupForm(props: Readonly<Props>) {
const { group } = props;
- const { mutate: deleteGroup, isLoading } = useDeleteGroupMutation();
+ const { mutate: deleteGroup, isPending } = useDeleteGroupMutation();
const onSubmit = () => {
deleteGroup(group.id, {
@@ -45,7 +45,7 @@ export default function DeleteGroupForm(props: Readonly<Props>) {
onClose={props.onClose}
body={translateWithParameters('groups.delete_group.confirmation', group.name)}
primaryButton={
- <DangerButtonPrimary autoFocus type="submit" onClick={onSubmit} disabled={isLoading}>
+ <DangerButtonPrimary autoFocus type="submit" onClick={onSubmit} disabled={isPending}>
{translate('delete')}
</DangerButtonPrimary>
}
diff --git a/server/sonar-web/src/main/js/apps/groups/components/EditMembersModal.tsx b/server/sonar-web/src/main/js/apps/groups/components/EditMembersModal.tsx
index fa75a1e9932..bcb718b48a6 100644
--- a/server/sonar-web/src/main/js/apps/groups/components/EditMembersModal.tsx
+++ b/server/sonar-web/src/main/js/apps/groups/components/EditMembersModal.tsx
@@ -28,6 +28,7 @@ import { translate } from '../../../helpers/l10n';
import {
useAddGroupMembershipMutation,
useGroupMembersQuery,
+ useRemoveGroupMembersQueryFromCache,
useRemoveGroupMembershipMutation,
} from '../../../queries/group-memberships';
import { Group } from '../../../types/types';
@@ -46,16 +47,12 @@ export default function EditMembersModal(props: Readonly<Props>) {
const [filter, setFilter] = React.useState<SelectListFilter>(SelectListFilter.Selected);
const { mutateAsync: addUserToGroup } = useAddGroupMembershipMutation();
const { mutateAsync: removeUserFromGroup } = useRemoveGroupMembershipMutation();
- const {
- data,
- isLoading,
- fetchNextPage,
- remove: emptyQueryCache,
- } = useGroupMembersQuery({
+ const { data, isLoading, fetchNextPage } = useGroupMembersQuery({
q: query,
groupId: group.id,
filter,
});
+ const emptyQueryCache = useRemoveGroupMembersQueryFromCache();
const users: (RestUserBase & { selected?: boolean })[] =
data?.pages.flatMap((page) => page.users) ?? [];
diff --git a/server/sonar-web/src/main/js/apps/groups/components/GroupForm.tsx b/server/sonar-web/src/main/js/apps/groups/components/GroupForm.tsx
index 9865567daff..0b76702de2f 100644
--- a/server/sonar-web/src/main/js/apps/groups/components/GroupForm.tsx
+++ b/server/sonar-web/src/main/js/apps/groups/components/GroupForm.tsx
@@ -43,8 +43,8 @@ export default function GroupForm(props: Props) {
const [name, setName] = useState<string>(create ? '' : group.name);
const [description, setDescription] = useState<string>(create ? '' : group.description ?? '');
- const { mutate: createGroup, isLoading: isCreating } = useCreateGroupMutation();
- const { mutate: updateGroup, isLoading: isUpdating } = useUpdateGroupMutation();
+ const { mutate: createGroup, isPending: isCreating } = useCreateGroupMutation();
+ const { mutate: updateGroup, isPending: isUpdating } = useUpdateGroupMutation();
const handleCreateGroup = () => {
createGroup({ name, description }, { onSuccess: props.onClose });