Skip to content

Commit c20cb7a

Browse files
chore: improving querykeys
1 parent 2cf8ac9 commit c20cb7a

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"*.scss"
1919
],
2020
"scripts": {
21-
"dev": "PORT=8081 PUBLIC_PATH=/instructor openedx dev",
21+
"dev": "PORT=8080 PUBLIC_PATH=/instructor openedx dev",
2222
"i18n_extract": "openedx formatjs extract",
2323
"lint": "openedx lint .",
2424
"lint:fix": "openedx lint --fix .",

src/data/apiHook.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ const COURSE_INFO_QUERY_KEY = ['courseInfo'];
66

77
const dateExtensionsQueryKeys = {
88
all: [appId, 'dateExtensions'] as const,
9-
byId: (id: string) => [...dateExtensionsQueryKeys.all, id] as const,
9+
byCourse: (courseId: string) => [...dateExtensionsQueryKeys.all, courseId] as const,
10+
byCoursePaginated: (courseId: string, pagination: PaginationQueryKeys) => [...dateExtensionsQueryKeys.byCourse(courseId), pagination.page] as const,
1011
};
1112

1213
export const useCourseInfo = (courseId: string) => (
@@ -18,7 +19,7 @@ export const useCourseInfo = (courseId: string) => (
1819

1920
export const useDateExtensions = (courseId: string, pagination: PaginationQueryKeys) => (
2021
useQuery({
21-
queryKey: dateExtensionsQueryKeys.all,
22+
queryKey: dateExtensionsQueryKeys.byCoursePaginated(courseId, pagination),
2223
queryFn: () => getDateExtensions(courseId, pagination),
2324
})
2425
);

src/dateExtensions/components/DateExtensionsList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { useState } from 'react';
1212
// { id: 2, username: 'dianaSalas', fullname: 'Diana Villalvazo', email: 'diana.villalvazo@example.com', graded_subsection: 'Three body diagrams', extended_due_date: '2026-07-15' },
1313
// ];
1414

15-
export const DATE_EXTENSIONS_PAGE_SIZE = 25;
15+
const DATE_EXTENSIONS_PAGE_SIZE = 25;
1616

1717
export interface DateExtensionListProps {
1818
onResetExtensions?: (user: LearnerDateExtension) => void,

0 commit comments

Comments
 (0)