diff --git a/components/CollectionSelection.tsx b/components/CollectionSelection.tsx index e9aa758..cb66b14 100644 --- a/components/CollectionSelection.tsx +++ b/components/CollectionSelection.tsx @@ -55,8 +55,7 @@ const CollectionItem = ({ active: string; collections: CollectionIncludingMembersAndLinkCount[]; }) => { - const hasChildren = - collection.subCollections && collection.subCollections.length > 0; + const hasChildren = collections.some((e) => e.parentId === collection.id); const router = useRouter(); diff --git a/lib/api/controllers/collections/collectionId/getCollectionById.ts b/lib/api/controllers/collections/collectionId/getCollectionById.ts index e508399..46478b8 100644 --- a/lib/api/controllers/collections/collectionId/getCollectionById.ts +++ b/lib/api/controllers/collections/collectionId/getCollectionById.ts @@ -16,7 +16,6 @@ export default async function getCollectionById( _count: { select: { links: true }, }, - subCollections: true, members: { include: { user: { diff --git a/lib/api/controllers/collections/collectionId/updateCollectionById.ts b/lib/api/controllers/collections/collectionId/updateCollectionById.ts index ea75002..e300662 100644 --- a/lib/api/controllers/collections/collectionId/updateCollectionById.ts +++ b/lib/api/controllers/collections/collectionId/updateCollectionById.ts @@ -75,7 +75,6 @@ export default async function updateCollection( _count: { select: { links: true }, }, - subCollections: true, members: { include: { user: { diff --git a/lib/api/controllers/collections/getCollections.ts b/lib/api/controllers/collections/getCollections.ts index 9f75d31..3742163 100644 --- a/lib/api/controllers/collections/getCollections.ts +++ b/lib/api/controllers/collections/getCollections.ts @@ -12,7 +12,6 @@ export default async function getCollection(userId: number) { _count: { select: { links: true }, }, - subCollections: true, members: { include: { user: { diff --git a/pages/collections/[id].tsx b/pages/collections/[id].tsx index be55933..6c23d40 100644 --- a/pages/collections/[id].tsx +++ b/pages/collections/[id].tsx @@ -124,8 +124,7 @@ export default function Index() {
- {activeCollection.subCollections && - activeCollection.subCollections.length > 0 ? ( + {collections.some((e) => e.parentId === activeCollection.id) ? ({activeCollection?.description}
) : undefined} - {/* {activeCollection?.subCollections && - activeCollection?.subCollections.length > 0 ? ( + {/* {collections.some((e) => e.parentId === activeCollection.id) ? (