From d79b88e0b6f65018d570a0cb13179b5a33a39e4e Mon Sep 17 00:00:00 2001 From: cfngc4594 Date: Thu, 20 Mar 2025 16:10:11 +0800 Subject: [PATCH] refactor(page): simplify WorkspaceEditorPage by removing unnecessary database queries and state management --- .../problems/[id]/@workspace/@editor/page.tsx | 51 +++---------------- 1 file changed, 8 insertions(+), 43 deletions(-) diff --git a/src/app/(app)/problems/[id]/@workspace/@editor/page.tsx b/src/app/(app)/problems/[id]/@workspace/@editor/page.tsx index 9d236d5..d56bf54 100644 --- a/src/app/(app)/problems/[id]/@workspace/@editor/page.tsx +++ b/src/app/(app)/problems/[id]/@workspace/@editor/page.tsx @@ -1,50 +1,15 @@ -import prisma from "@/lib/prisma"; -import { notFound } from "next/navigation"; import { CodeEditor } from "@/components/problem-editor"; -import { ProblemEditorProvider } from "@/providers/problem-editor-provider"; import { WorkspaceEditorHeader } from "@/components/features/playground/workspace/editor/components/header"; import { WorkspaceEditorFooter } from "@/components/features/playground/workspace/editor/components/footer"; -interface WorkspaceEditorProps { - params: Promise<{ id: string }>; -} - -export default async function WorkspaceEditorPage({ - params, -}: WorkspaceEditorProps) { - const { id } = await params; - - const [ - problem, - editorLanguageConfigs, - languageServerConfigs, - ] = await Promise.all([ - prisma.problem.findUnique({ - where: { id }, - select: { templates: true }, - }), - prisma.editorLanguageConfig.findMany(), - prisma.languageServerConfig.findMany(), - ]); - - if (!problem) { - return notFound(); - } - +export default function WorkspaceEditorPage() { return ( - - <> - -
- -
- - -
+ <> + +
+ +
+ + ); }