[Feature Request] Support same collection with different EntityCollection
See original GitHub issueFirst of all, great library!
Problem:
I have a collection"Posts". I wanted to have a separate EntityCollectionView
or page for allPosts
and has initialFilters
for pendingPosts
Ideal scenario on the navigation page. I have both “All Posts” and “Pending Posts”.
I tried creating a custom view
const pendingPostsCollection = buildCollection<Partial<Post>>({
initialFilter: filterPendingPosts,
name: 'Pending Posts',
path: 'posts',
permissions: editOnlyPermission,
schema: pendingPosts,
textSearchEnabled: true,
});
const customViews: CMSView[] = [
{
name: 'Pending Posts',
path: ['pendingPosts'],
// This can be any React component
view: <EntityCollectionView collection={pendingPostsCollection} path="posts" />,
},
];
But this implementation requires me to have an existing path for “posts” in navigation or else it doesn’t resolve any schema even tho I already passed in a collection (My guess is it’s binded somewhere on navigation).
However, if I do put a path for “posts” which is the “All Posts” EntityCollection. It resolves to the existing an existing schema “All Posts” EntityCollection and doesn’t work as intended since my initialFilters
and customized pendingPostsSchema
isn’t there.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top GitHub Comments
This feature will be available in version 2.0.0 since we hace introduced collection aliases, allowing developers to have multiple collections in the same path
Hi @jeemercado We have big changes regarding how collections are resolved internally for version 2.0 and will keep this feature in mind. Yeah, right now the path acts as an id so it is hard to change this behaviour at this point. Thank you for the feedback!