From f662d34b8dd4605a2977ca29c7e439e36cd66c94 Mon Sep 17 00:00:00 2001 From: Felix Gnass Date: Mon, 24 Mar 2025 10:10:32 +0100 Subject: [PATCH] feat: include slug and path in result --- .../Editor/EditorPreviewPane/EditorPreviewPane.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/decap-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js b/packages/decap-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js index 39424176ac95..65d3c49fd305 100644 --- a/packages/decap-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js +++ b/packages/decap-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js @@ -222,17 +222,18 @@ export class PreviewPane extends React.Component { * This function exists entirely to expose collections from outside of this entry * */ - getCollection = async (collectionName, slug) => { + getCollection = async (collectionName, slugToLoad) => { const { state } = this.props; const selectedCollection = state.collections.get(collectionName); - if (typeof slug === 'undefined') { + if (typeof slugToLoad === 'undefined') { const entries = await getAllEntries(state, selectedCollection); - return entries.map(entry => Map().set('data', entry.data)); + + return entries.map(({ data, slug, path }) => Map({ data, slug, path })); } - const entry = await tryLoadEntry(state, selectedCollection, slug); - return Map().set('data', entry.data); + const { data, slug, path } = await tryLoadEntry(state, selectedCollection, slugToLoad); + return Map({ data, slug, path }); }; render() {