From c4ac63a0e8b335afdd7e362d07b5861dc0ec27c4 Mon Sep 17 00:00:00 2001 From: Jonas Zeiger Date: Fri, 31 Mar 2023 04:59:38 +0200 Subject: [PATCH 1/2] 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; From 2858b990d45090908d3954f03c091b3b1991f9ba Mon Sep 17 00:00:00 2001 From: Daniel Lautzenheiser Date: Fri, 31 Mar 2023 13:58:21 -0400 Subject: [PATCH 2/2] v1.2.14 --- lerna.json | 2 +- packages/app/package.json | 4 ++-- packages/core/package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lerna.json b/lerna.json index 5186af2a..386ead68 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", "useWorkspaces": true, - "version": "1.2.13" + "version": "1.2.14" } diff --git a/packages/app/package.json b/packages/app/package.json index b8a5c4ac..ba3d32d1 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -1,6 +1,6 @@ { "name": "@staticcms/app", - "version": "1.2.13", + "version": "1.2.14", "license": "MIT", "description": "Static CMS application.", "repository": "https://github.com/StaticJsCMS/static-cms", @@ -35,7 +35,7 @@ "@babel/eslint-parser": "7.21.3", "@babel/runtime": "7.21.0", "@emotion/babel-preset-css-prop": "11.10.0", - "@staticcms/core": "^1.2.13", + "@staticcms/core": "^1.2.14", "buffer": "6.0.3", "react": "18.2.0", "react-dom": "18.2.0", diff --git a/packages/core/package.json b/packages/core/package.json index fafe4020..85d12925 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@staticcms/core", - "version": "1.2.13", + "version": "1.2.14", "license": "MIT", "description": "Static CMS core application.", "repository": "https://github.com/StaticJsCMS/static-cms",