From fae2a105ab40c89d2948e5b2a8e518565951317d Mon Sep 17 00:00:00 2001 From: Net-Slayer <14405930+Net-Slayer@users.noreply.github.com> Date: Fri, 8 Dec 2023 20:47:03 +0000 Subject: [PATCH] * Applied changes from decap PR for non-index files https://github.com/decaporg/decap-cms/pull/6498 --- .../components/collections/NestedCollection.tsx | 7 ++++--- .../collections/entries/EntriesCollection.tsx | 16 +++++++++------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/core/src/components/collections/NestedCollection.tsx b/packages/core/src/components/collections/NestedCollection.tsx index 9eca254e1..88ed86490 100644 --- a/packages/core/src/components/collections/NestedCollection.tsx +++ b/packages/core/src/components/collections/NestedCollection.tsx @@ -83,7 +83,8 @@ const TreeNode = ({ return ( <> {sortedData.map(node => { - const leaf = node.children.length <= 1 && !node.children[0]?.isDir && depth > 0; + // const leaf = node.children.length <= 1 && !node.children[0]?.isDir && depth > 0; + const leaf = node.children.length === 0 && depth > 0; if (leaf) { return null; } @@ -93,8 +94,8 @@ const TreeNode = ({ } const title = getNodeTitle(node); - const hasChildren = depth === 0 || node.children.some(c => c.children.some(c => c.isDir)); - + // const hasChildren = depth === 0 || node.children.some(c => c.children.some(c => c.isDir)); + const hasChildren = depth === 0 || node.children.some(c => c.isDir); return (
{ - const entryPath = e.path.slice(collectionFolder.length + 1); + let entryPath = e.path.slice(collectionFolder.length + 1); if (!entryPath.startsWith(path)) { return false; } // only show immediate children if (path) { - // non root path - const trimmed = entryPath.slice(path.length + 1); - return trimmed.split('/').length === 2; - } else { - // root path - return entryPath.split('/').length <= 2; + // // non root path + // const trimmed = entryPath.slice(path.length + 1); + // return trimmed.split('/').length === 2; + // } else { + // // root path + // return entryPath.split('/').length <= 2; + entryPath = entryPath.slice(path.length + 1); } + return !entryPath.includes('/'); }); return filtered; }