fix:check

This commit is contained in:
yujiangping
2026-02-10 12:53:41 +08:00
parent 1097d699f8
commit b26f60ee8d
3 changed files with 48 additions and 5 deletions

View File

@@ -33,8 +33,8 @@ const DocumentDetails: FC = () => {
documentId,
parentId: locationParentId,
breadcrumbPath
} = location.state as {
documentId: string;
} = (location.state || {}) as {
documentId?: string;
parentId?: string;
breadcrumbPath?: BreadcrumbPath;
};
@@ -51,6 +51,18 @@ const DocumentDetails: FC = () => {
const insertModalRef = useRef<InsertModalRef>(null);
const isManualRefreshRef = useRef(false);
// Early return if no documentId
if (!documentId) {
return (
<div className="rb:flex rb:items-center rb:justify-center rb:h-full rb:flex-col rb:gap-4">
<div className="rb:text-gray-500">{t('knowledgeBase.documentIdRequired') || '文档ID不能为空'}</div>
<Button type="primary" onClick={() => navigate(-1)}>
{t('common.back') || '返回'}
</Button>
</div>
);
}
useEffect(() => {
if (documentId) {
fetchDocumentDetail();