From 13613595b742d5d50557491d4794cc3ea6506ef9 Mon Sep 17 00:00:00 2001 From: Alex Mickelson Date: Thu, 3 Oct 2024 15:40:43 -0600 Subject: [PATCH] more aggressive refetching --- README.md | 5 ++++- .../context/DraggingContextProvider.tsx | 15 ++++++--------- nextjs/src/hooks/localCourse/courseItemHooks.ts | 7 ++++--- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 35ecb24..699f117 100644 --- a/README.md +++ b/README.md @@ -54,4 +54,7 @@ tighter integration with git - regularly make git commits - handle merging? - maybe a different storage backend? -- user motivated restore? \ No newline at end of file +- user motivated restore? + +display days settings +- hide all sundays (horizontal space) diff --git a/nextjs/src/app/course/[courseName]/context/DraggingContextProvider.tsx b/nextjs/src/app/course/[courseName]/context/DraggingContextProvider.tsx index eec8016..6fb47d3 100644 --- a/nextjs/src/app/course/[courseName]/context/DraggingContextProvider.tsx +++ b/nextjs/src/app/course/[courseName]/context/DraggingContextProvider.tsx @@ -163,14 +163,11 @@ export default function DraggingContextProvider({ const assignment: LocalAssignment = { ...previousAssignment, dueAt: dateToMarkdownString(dayAsDate), - lockAt: - previousAssignment.lockAt && - (getDateFromStringOrThrow( - previousAssignment.lockAt, - "lockAt date" - ) > dayAsDate - ? previousAssignment.lockAt - : dateToMarkdownString(dayAsDate)), + lockAt: getNewLockDate( + previousAssignment.dueAt, + previousAssignment.lockAt, + dayAsDate + ), }; updateAssignmentMutation.mutate({ item: assignment, @@ -208,7 +205,7 @@ function getNewLockDate( dayAsDate: Date ): string | undefined { // todo: preserve previous due date / lock date offset - const dueDate = getDateFromStringOrThrow(originalDueDate, "dueat date"); + const dueDate = getDateFromStringOrThrow(originalDueDate, "dueAt date"); const lockDate = originalLockDate === undefined ? undefined diff --git a/nextjs/src/hooks/localCourse/courseItemHooks.ts b/nextjs/src/hooks/localCourse/courseItemHooks.ts index 9b2a8b5..205861b 100644 --- a/nextjs/src/hooks/localCourse/courseItemHooks.ts +++ b/nextjs/src/hooks/localCourse/courseItemHooks.ts @@ -167,9 +167,11 @@ export const useUpdateItemMutation = (type: T) => { itemName, type ), + refetchType: "all", }); await queryClient.invalidateQueries({ queryKey: localCourseKeys.allItemsOfType(courseName, moduleName, type), + refetchType: "all", }); }, }); @@ -242,10 +244,9 @@ export const useDeleteItemMutation = (type: T) => { await axiosClient.delete(url); }, onSuccess: async (_, { moduleName, itemName }) => { - queryClient.invalidateQueries({ queryKey: localCourseKeys.allItemsOfType(courseName, moduleName, type), - refetchType: "all" + refetchType: "all", }); queryClient.invalidateQueries({ queryKey: localCourseKeys.itemOfType( @@ -254,7 +255,7 @@ export const useDeleteItemMutation = (type: T) => { itemName, type ), - refetchType: "none" + refetchType: "none", }); }, });