Skip to content

Commit f662d34

Browse files
committed
feat: include slug and path in result
1 parent 86d41d7 commit f662d34

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

packages/decap-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,17 +222,18 @@ export class PreviewPane extends React.Component {
222222
* This function exists entirely to expose collections from outside of this entry
223223
*
224224
*/
225-
getCollection = async (collectionName, slug) => {
225+
getCollection = async (collectionName, slugToLoad) => {
226226
const { state } = this.props;
227227
const selectedCollection = state.collections.get(collectionName);
228228

229-
if (typeof slug === 'undefined') {
229+
if (typeof slugToLoad === 'undefined') {
230230
const entries = await getAllEntries(state, selectedCollection);
231-
return entries.map(entry => Map().set('data', entry.data));
231+
232+
return entries.map(({ data, slug, path }) => Map({ data, slug, path }));
232233
}
233234

234-
const entry = await tryLoadEntry(state, selectedCollection, slug);
235-
return Map().set('data', entry.data);
235+
const { data, slug, path } = await tryLoadEntry(state, selectedCollection, slugToLoad);
236+
return Map({ data, slug, path });
236237
};
237238

238239
render() {

0 commit comments

Comments
 (0)