@crimson-education/sdk 0.3.13 → 0.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core/tasks.js
CHANGED
|
@@ -22,11 +22,9 @@ const normalizeTask = (raw) => {
|
|
|
22
22
|
throw new Error("Task object missing required 'id' field");
|
|
23
23
|
}
|
|
24
24
|
const statusUpper = typeof raw.status === "string" ? raw.status.toUpperCase() : undefined;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
? statusUpper === "DONE"
|
|
29
|
-
: Boolean(raw.finishedAt);
|
|
25
|
+
// Use status as the source of truth for completion.
|
|
26
|
+
// Keep isComplete for backward compatibility with existing consumers.
|
|
27
|
+
const isComplete = statusUpper === "DONE";
|
|
30
28
|
return {
|
|
31
29
|
id: (_a = raw.id) !== null && _a !== void 0 ? _a : "",
|
|
32
30
|
name: (_c = (_b = raw.name) !== null && _b !== void 0 ? _b : raw.description) !== null && _c !== void 0 ? _c : "",
|
|
@@ -240,7 +240,7 @@ function useAllUserTasks(missionLinkIds, enabled) {
|
|
|
240
240
|
function useTasksByRoadmapId(roadmapId, userId, enabled, filters) {
|
|
241
241
|
const client = (0, provider_1.useCrimsonClient)();
|
|
242
242
|
return (0, react_query_1.useQuery)({
|
|
243
|
-
queryKey: [...exports.taskKeys.all, "roadmap", roadmapId, userId],
|
|
243
|
+
queryKey: [...exports.taskKeys.all, "roadmap", roadmapId, userId, filters],
|
|
244
244
|
queryFn: () => __awaiter(this, void 0, void 0, function* () {
|
|
245
245
|
if (!roadmapId || !userId) {
|
|
246
246
|
return [];
|
|
@@ -333,7 +333,12 @@ function useCreateTask(options) {
|
|
|
333
333
|
queryClient.setQueryData(exports.taskKeys.list(newTodo.missionId), context.previousTasks);
|
|
334
334
|
},
|
|
335
335
|
onSettled: () => {
|
|
336
|
-
|
|
336
|
+
if (optimistic) {
|
|
337
|
+
invalidateTaskQueriesExcludingInfinite(queryClient);
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
queryClient.invalidateQueries({ queryKey: exports.taskKeys.all });
|
|
341
|
+
}
|
|
337
342
|
},
|
|
338
343
|
});
|
|
339
344
|
}
|