Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down