From f7fcc71a99750d8e052db314dd868a1cdf13e739 Mon Sep 17 00:00:00 2001 From: fantasticit Date: Tue, 12 Apr 2022 15:29:39 +0800 Subject: [PATCH] fix: fix get document children --- packages/client/src/data/document.ts | 7 +++++-- packages/server/src/services/document.service.ts | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/client/src/data/document.ts b/packages/client/src/data/document.ts index 9442d064..6fc2d007 100644 --- a/packages/client/src/data/document.ts +++ b/packages/client/src/data/document.ts @@ -221,8 +221,11 @@ export const useCollaborationDocument = (documentId) => { */ export const useChildrenDocument = ({ wikiId, documentId, isShare = false }) => { const { data, error, mutate } = useSWR>( - isShare ? '/document/public/children' : `/document/children`, - wikiId || documentId ? (url) => HttpClient.post(url, { wikiId, documentId, isShare }) : null, + wikiId + '/' + documentId, + wikiId || documentId + ? () => + HttpClient.post(isShare ? '/document/public/children' : `/document/children`, { wikiId, documentId, isShare }) + : null, { shouldRetryOnError: false } ); const loading = !data && !error; diff --git a/packages/server/src/services/document.service.ts b/packages/server/src/services/document.service.ts index 28c04859..0f92f277 100644 --- a/packages/server/src/services/document.service.ts +++ b/packages/server/src/services/document.service.ts @@ -495,6 +495,7 @@ export class DocumentService { if (document.isWikiHome) { unSortDocuments = await this.documentRepo.find({ wikiId: document.wikiId, + parentDocumentId: null, isWikiHome: false, }); } else {