aritra24 commented on code in PR #50732:
URL: https://github.com/apache/airflow/pull/50732#discussion_r2124699845
##########
airflow-core/src/airflow/ui/openapi-gen/queries/customInfiniteQueries.ts:
##########
@@ -0,0 +1,38 @@
+import { InfiniteData, useInfiniteQuery, UseInfiniteQueryOptions } from
"@tanstack/react-query";
+
+import { DagService } from "openapi/requests/services.gen";
+
+import * as Common from "./common";
+
+export const useDagServiceGetDagTagsInfinite = <
+ TData = InfiniteData<Common.DagServiceGetDagTagsDefaultResponse>,
+ TError = unknown,
+ TQueryKey extends Array<unknown> = unknown[],
+>(
+ {
+ limit,
+ orderBy,
+ tagNamePattern,
+ }: {
+ limit?: number;
+ orderBy?: string;
+ tagNamePattern?: string;
+ } = {},
+ queryKey?: TQueryKey,
+ options?: Omit<UseInfiniteQueryOptions<TData, TError>, "queryKey" |
"queryFn">,
+) =>
+ useInfiniteQuery({
+ queryKey: Common.UseDagServiceGetDagTagsKeyFn({ limit, orderBy,
tagNamePattern }, queryKey),
+ queryFn: ({ pageParam }) =>
+ DagService.getDagTags({ limit, offset: pageParam as number, orderBy,
tagNamePattern }) as TData,
+ initialPageParam: 0,
+ getNextPageParam: (lastPage, _allPages, lastPageParam, _allPageParams) =>
+ (lastPageParam as number) < (lastPage as
Common.DagServiceGetDagTagsDefaultResponse).total_entries
+ ? (lastPage as Common.DagServiceGetDagTagsDefaultResponse).tags.length
+ (lastPageParam as number)
+ : undefined,
+ getPreviousPageParam: (firstPage, _allPages, firstPageParam,
_allPageParams) =>
+ (firstPageParam as number) > 0
+ ? -(firstPage as
Common.DagServiceGetDagTagsDefaultResponse).tags.length + (firstPageParam as
number)
+ : undefined,
Review Comment:
I can try 🤞, thanks for the pointer
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]