feat(judge): add revalidation for problem page after submission

This commit is contained in:
cfngc4594 2025-04-13 11:16:26 +08:00
parent fd50e72518
commit 7d7e503c8e

View File

@ -8,6 +8,7 @@ import { auth } from "@/lib/auth";
import { redirect } from "next/navigation"; import { redirect } from "next/navigation";
import { Readable, Writable } from "stream"; import { Readable, Writable } from "stream";
import { Status } from "@/generated/client"; import { Status } from "@/generated/client";
import { revalidatePath } from "next/cache";
import type { ProblemWithTestcases, TestcaseWithDetails } from "@/types/prisma"; import type { ProblemWithTestcases, TestcaseWithDetails } from "@/types/prisma";
import type { EditorLanguage, Submission, TestcaseResult } from "@/generated/client"; import type { EditorLanguage, Submission, TestcaseResult } from "@/generated/client";
@ -220,6 +221,7 @@ export async function judge(
return submission; return submission;
} }
} finally { } finally {
revalidatePath(`/problems/${problemId}`);
if (container) { if (container) {
try { try {
await container.kill(); await container.kill();