sts-sponsors team mailing list archive
-
sts-sponsors team
-
Mailing list archive
-
Message #06734
Re: [Merge] ~jonesogolo/maas-site-manager:1526-add-empty-states-to-regions-table into maas-site-manager:main
Diff comments:
> diff --git a/frontend/src/hooks/api.ts b/frontend/src/hooks/api.ts
> index fea9ea1..438b5cd 100644
> --- a/frontend/src/hooks/api.ts
> +++ b/frontend/src/hooks/api.ts
> @@ -41,6 +41,14 @@ export const useRequestsQuery = ({ page, size }: GetEnrollmentRequestsQueryParam
> refetchInterval: defaultRefetchInterval,
> });
>
> +export const useRequestsCountQuery = () =>
> + useQuery<EnrollmentRequestsQueryResult>({
> + queryKey: ["requests", "0", "50"],
> + queryFn: () => getEnrollmentRequests({ page: "0", size: "50" }),
There's no need to actually request 50 results, all we care about is the total number. This means that the size could be 1 (or even 0, not sure what would be the result of sending 0?).
Thorsten: As a side note, a cleaner solution would be creating a separate endpoint for getting just the count.
> + keepPreviousData: true,
> + refetchInterval: defaultRefetchInterval,
> + });
> +
> export const useEnrollmentRequestsMutation = (
> options: UseMutationOptions<unknown, unknown, PostEnrollmentRequestsData, unknown>,
> ) => useMutation(patchEnrollmentRequests, options);
--
https://code.launchpad.net/~jonesogolo/maas-site-manager/+git/maas-site-manager/+merge/440258
Your team MAAS Committers is requested to review the proposed merge of ~jonesogolo/maas-site-manager:1526-add-empty-states-to-regions-table into maas-site-manager:main.