From c647cb62f1cbf1af9841ae8cb3818e34bb566c9c Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Tue, 7 Jul 2026 09:21:57 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F(frontend)=20change=20search?= =?UTF-8?q?=20using=20document=20path=20to=20its=20id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The search endpoint does not accept anymore the usage of the path parameter but it is using the document id directly. We have to reflect this changes in the frontend application. --- .../Interlinking/SearchPage.tsx | 2 +- .../features/docs/doc-search/api/useSearchDocs.tsx | 12 ++++++------ .../docs/doc-search/components/DocSearchContent.tsx | 8 ++++---- .../docs/doc-search/components/DocSearchModal.tsx | 8 ++++---- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-inline-content/Interlinking/SearchPage.tsx b/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-inline-content/Interlinking/SearchPage.tsx index f685735f3..42f8b8d77 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-inline-content/Interlinking/SearchPage.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-inline-content/Interlinking/SearchPage.tsx @@ -263,7 +263,7 @@ export const SearchPage = ({ { if (!isEditable) { diff --git a/src/frontend/apps/impress/src/features/docs/doc-search/api/useSearchDocs.tsx b/src/frontend/apps/impress/src/features/docs/doc-search/api/useSearchDocs.tsx index 54339e493..0074cdca7 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-search/api/useSearchDocs.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-search/api/useSearchDocs.tsx @@ -15,21 +15,21 @@ export type SearchDocsParams = { page: number; q: string; filter?: DocSearchFilterTypes; - parentPath?: string; + parentDocId?: string; }; const constructParams = ({ q, page, filter, - parentPath, + parentDocId, }: SearchDocsParams): URLSearchParams => { const searchParams = new URLSearchParams(); searchParams.set('q', q); - if (filter === 'current' && parentPath) { - searchParams.set('path', parentPath); + if (filter === 'current' && parentDocId) { + searchParams.set('document', parentDocId); } if (page) { searchParams.set('page', page.toString()); @@ -48,9 +48,9 @@ const searchDocs = async ({ q, page, filter, - parentPath, + parentDocId, }: SearchDocsParams): Promise => { - const searchParams = constructParams({ q, page, filter, parentPath }); + const searchParams = constructParams({ q, page, filter, parentDocId }); const response = await fetchAPI( `documents/search/?${searchParams.toString()}`, ); diff --git a/src/frontend/apps/impress/src/features/docs/doc-search/components/DocSearchContent.tsx b/src/frontend/apps/impress/src/features/docs/doc-search/components/DocSearchContent.tsx index 2044d401e..909d43628 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-search/components/DocSearchContent.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-search/components/DocSearchContent.tsx @@ -19,7 +19,7 @@ type DocSearchContentProps = { onResults?: (results: DocSearch[]) => void; onSelect: (doc: DocSearch) => void; onLoadingChange?: (loading: boolean) => void; - parentPath?: string; + parentDocId?: string; renderSearchElement?: (doc: DocSearch) => React.ReactNode; }; @@ -31,7 +31,7 @@ export const DocSearchContent = ({ onSelect, onLoadingChange, renderSearchElement, - parentPath, + parentDocId, isSearchNotMandatory, }: DocSearchContentProps) => { const { filter } = useDocSearchFilterStore(); @@ -47,10 +47,10 @@ export const DocSearchContent = ({ q: search, page: 1, filter, - parentPath, + parentDocId, }, { - enabled: filter !== 'current' || !!parentPath, + enabled: filter !== 'current' || !!parentDocId, }, ); diff --git a/src/frontend/apps/impress/src/features/docs/doc-search/components/DocSearchModal.tsx b/src/frontend/apps/impress/src/features/docs/doc-search/components/DocSearchModal.tsx index d08f55dad..572d88aac 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-search/components/DocSearchModal.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-search/components/DocSearchModal.tsx @@ -41,13 +41,13 @@ type DocSearchModalGlobalProps = { isOpen: boolean; showFilters?: boolean; defaultFilters: DocSearchFilterTypes; - parentPath?: string; // If defined, the search will be limited to the children of the document with the given path + parentDocId?: string; // If defined, the search will be limited to the children of the document with the given id }; const DocSearchModalGlobal = ({ showFilters = false, defaultFilters, - parentPath, + parentDocId, ...modalProps }: DocSearchModalGlobalProps) => { const { t } = useTranslation(); @@ -175,7 +175,7 @@ const DocSearchModalGlobal = ({ onSelect={handleSelect} onResults={setResults} onLoadingChange={setLoading} - parentPath={filter === 'current' ? parentPath : undefined} + parentDocId={filter === 'current' ? parentDocId : undefined} /> )} @@ -203,7 +203,7 @@ const DocSearchModalDetail = ({ {...modalProps} showFilters={isWithChildren && authenticated} defaultFilters={isWithChildren ? 'current' : 'all'} - parentPath={treeContext?.root?.path} + parentDocId={treeContext?.root?.id} /> ); };