diff --git a/apps/frontend/app/admin/problem/[id]/edit/page.tsx b/apps/frontend/app/admin/problem/[id]/edit/page.tsx index 3b670e930b..f7da9e2b99 100644 --- a/apps/frontend/app/admin/problem/[id]/edit/page.tsx +++ b/apps/frontend/app/admin/problem/[id]/edit/page.tsx @@ -38,13 +38,12 @@ export default function Page({ params }: { params: { id: string } }) { const methods = useForm({ resolver: zodResolver(editSchema), - defaultValues: { - template: [] - } + defaultValues: { template: [] } }) const { handleSubmit, setValue, getValues } = methods + const [blockEdit, setBlockEdit] = useState(false) const [showHint, setShowHint] = useState(false) const [showSource, setShowSource] = useState(false) const [isDialogOpen, setDialogOpen] = useState(false) @@ -57,6 +56,9 @@ export default function Page({ params }: { params: { id: string } }) { }, onCompleted: (problemData) => { const data = problemData.getProblem + + if (data.submissionCount > 0) setBlockEdit(true) + setValue('id', +id) setValue('title', data.title) setValue('isVisible', data.isVisible) @@ -193,10 +195,10 @@ export default function Page({ params }: { params: { id: string } }) { - {getValues('testcases') && } + {getValues('testcases') && } - + onRemove()} />