Fix pagination: disable Next correctly for workflows and run history (#3293)

Co-authored-by: Fratiman <bogdanfrman@yahoo.com>
This commit is contained in:
dvloper-bogdan
2025-09-05 02:30:47 +03:00
committed by GitHub
parent 871c63e079
commit d2c71a9542
3 changed files with 189 additions and 67 deletions

View File

@@ -11,17 +11,19 @@ type UseQueryOptions = Omit<
type Props = {
page?: number;
pageSize?: number;
statusFilters?: Array<Status>;
} & UseQueryOptions;
function useRunsQuery({ page = 1, statusFilters }: Props) {
function useRunsQuery({ page = 1, pageSize = 10, statusFilters }: Props) {
const credentialGetter = useCredentialGetter();
return useQuery<Array<Task | WorkflowRunApiResponse>>({
queryKey: ["runs", { statusFilters }, page],
queryKey: ["runs", { statusFilters }, page, pageSize],
queryFn: async () => {
const client = await getClient(credentialGetter);
const params = new URLSearchParams();
params.append("page", String(page));
params.append("page_size", String(pageSize));
if (statusFilters) {
statusFilters.forEach((status) => {
params.append("status", status);