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 b407144fe618..484fab1be45a 100644 --- a/packages/decap-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js +++ b/packages/decap-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js @@ -224,17 +224,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() {