From c4ac63a0e8b335afdd7e362d07b5861dc0ec27c4 Mon Sep 17 00:00:00 2001 From: Jonas Zeiger Date: Fri, 31 Mar 2023 04:59:38 +0200 Subject: [PATCH] fix: Nested Folders Feature Routing (#677) --- packages/core/src/components/App/App.tsx | 10 +++++----- .../core/src/components/Collection/CollectionRoute.tsx | 4 +++- packages/core/src/components/Editor/EditorRoute.tsx | 4 +++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/core/src/components/App/App.tsx b/packages/core/src/components/App/App.tsx index 0f329e48..6b3bc702 100644 --- a/packages/core/src/components/App/App.tsx +++ b/packages/core/src/components/App/App.tsx @@ -76,8 +76,8 @@ function CollectionSearchRedirect() { } function EditEntityRedirect() { - const { name, entryName } = useParams(); - return ; + const params = useParams(); + return ; } const App = ({ @@ -199,7 +199,7 @@ const App = ({ element={} /> } /> } /> } /> - } /> + } /> } /> } /> diff --git a/packages/core/src/components/Collection/CollectionRoute.tsx b/packages/core/src/components/Collection/CollectionRoute.tsx index 59bab5a8..a2dc3cd4 100644 --- a/packages/core/src/components/Collection/CollectionRoute.tsx +++ b/packages/core/src/components/Collection/CollectionRoute.tsx @@ -18,7 +18,9 @@ const CollectionRoute = ({ isSingleSearchResult, collections, }: CollectionRouteProps) => { - const { name, searchTerm, filterTerm } = useParams(); + const params = useParams(); + const { name, searchTerm } = params; + const filterTerm = params['*']; const collection = useMemo(() => { if (!name) { return false; diff --git a/packages/core/src/components/Editor/EditorRoute.tsx b/packages/core/src/components/Editor/EditorRoute.tsx index 9afccb40..185931ea 100644 --- a/packages/core/src/components/Editor/EditorRoute.tsx +++ b/packages/core/src/components/Editor/EditorRoute.tsx @@ -12,7 +12,9 @@ interface EditorRouteProps { } const EditorRoute = ({ newRecord = false, collections }: EditorRouteProps) => { - const { name, slug } = useParams(); + const params = useParams(); + const name = params.name; + const slug = params['*']; const shouldRedirect = useMemo(() => { if (!name) { return false;