Skip to content

Commit 778344e

Browse files
committed
finalizing eager load of pages for org program cards
1 parent b153838 commit 778344e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

frontends/api/src/mitxonline/hooks/courses/queries.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ const coursesQueries = {
3131
return coursesApi.apiV2CoursesList({ ...opts, page: pageParam }).then((res) => res.data)
3232
},
3333
initialPageParam: 1,
34-
getNextPageParam: (lastPage, allPages, pageParam): number => {
35-
return lastPage && lastPage.next ? (pageParam ? pageParam + 1 : 1) : 1
34+
getNextPageParam: (lastPage, allPages, pageParam): number | null => {
35+
return lastPage && lastPage.next ? (pageParam ? pageParam + 1 : null) : null
3636
},
3737
}),
3838
}

frontends/main/src/app-pages/DashboardPage/OrganizationContent.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,9 @@ const OrgProgramDisplay: React.FC<{
257257
<Skeleton width="100%" height="65px" style={{ marginBottom: "16px" }} />
258258
)
259259
if (programLoading || courses.isLoading) return skeleton
260-
if (!courses.isLoading) console.log(courses.data)
260+
261+
if (courses.hasNextPage && !courses.isFetching) courses.fetchNextPage()
262+
261263
const transformedCourses = transform.mitxonlineOrgCourses({
262264
courses: (() =>{
263265
let courseData: Array<CourseWithCourseRunsSerializerV2> = []

0 commit comments

Comments
 (0)