Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shivankacker committed Feb 1, 2024
1 parent 4996f5d commit d742cce
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/app/admin/tests/[testsuite_id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { Button, CheckBox, Input, TextArea } from "@/components/ui/interactive";
import { Document, DocumentType, Project } from "@/types/project";
import { API } from "@/utils/api";
import {
QueryFunction,
useInfiniteQuery,
useMutation,
useQuery,
} from "@tanstack/react-query";
Expand All @@ -22,6 +20,7 @@ import {
TestResult,
TestRunStatus,
} from "@/types/test";
import { useInfiQuery } from "@/utils/hooks/useInfiQuery";

export default function Page({ params }: { params: { testsuite_id: string } }) {
const router = useRouter();
Expand Down Expand Up @@ -108,7 +107,7 @@ export default function Page({ params }: { params: { testsuite_id: string } }) {
offset: number | null;
};

const fetchData: QueryFunction<APIResponse> = async ({ pageParam = 0 }) => {
const fetchData = async ({ pageParam = 0 }) => {
const offset = pageParam ? pageParam : 0;
const res = await API.tests.runs.list(testsuite_id, {
ordering: "-created_at",
Expand All @@ -123,12 +122,9 @@ export default function Page({ params }: { params: { testsuite_id: string } }) {
};

const { data, fetchNextPage, hasNextPage, isFetching, isLoading, refetch } =
useInfiniteQuery({
useInfiQuery({
queryKey: ["testruns"],
queryFn: fetchData,
getNextPageParam: (lastPage, pages) => {
return lastPage.results.length > 0 ? lastPage.offset : null;
},
queryFn: fetchData
});

useEffect(() => {
Expand Down

0 comments on commit d742cce

Please sign in to comment.