Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { sidebarOpen as sidebarOpenAtom } from '@/store/atoms/sidebar';
import { useEffect, useState, useCallback, useMemo } from 'react';
import { handleMarkAsCompleted } from '@/lib/utils';
import BookmarkButton from './bookmark/BookmarkButton';
import { refreshCourses } from './refreshCourses';
import Link from 'next/link';
import { Button } from './ui/button';
import { AnimatePresence, motion } from 'framer-motion';
Expand Down Expand Up @@ -294,6 +295,7 @@ function Check({ content }: { content: any }) {
const newState = !completed;
setCompleted(newState);
await handleMarkAsCompleted(newState, content.id);
refreshCourses('/courses/[courseId]','page');
},
[completed, content.id],
);
Expand Down
7 changes: 7 additions & 0 deletions src/components/refreshCourses.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"use server";

import { revalidatePath } from "next/cache";

export async function refreshCourses(path:string,type?:'page'|'layout') {
revalidatePath(path,type);
}