fix: Presenter for empty collection returns undefined for documentStructure

This commit is contained in:
Tom Moor
2021-12-11 13:53:11 -08:00
parent 19e85c63c2
commit 60223f4404

View File

@@ -18,7 +18,7 @@ export default function present(collection: Collection) {
createdAt: collection.createdAt,
updatedAt: collection.updatedAt,
deletedAt: collection.deletedAt,
documents: collection.documentStructure || [],
documents: collection.documentStructure,
};
// Handle the "sort" field being empty here for backwards compatability
@@ -29,7 +29,10 @@ export default function present(collection: Collection) {
};
}
data.documents = sortNavigationNodes(collection.documentStructure, data.sort);
data.documents = sortNavigationNodes(
collection.documentStructure || [],
data.sort
);
return data;
}