Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

bug fixed

daniel31x13392d98f0908c
diff --git a/components/CollectionSelection.tsx b/components/CollectionSelection.tsx
index e9aa7585..cb66b140 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 e5083990..46478b83 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 ea750025..e3006628 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 9f75d31c..37421636 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 be559330..6c23d400 100644
--- a/pages/collections/[id].tsx
+++ b/pages/collections/[id].tsx
@@ -124,8 +124,7 @@ export default function Index() {
</p>
</div>
- {activeCollection.subCollections &&
- activeCollection.subCollections.length > 0 ? (
+ {collections.some((e) => e.parentId === activeCollection.id) ? (
<details className="mt-2 mb-2">
<summary className="text-sm cursor-pointer select-none">
View Sub-Collections
@@ -260,8 +259,7 @@ export default function Index() {
<p>{activeCollection?.description}</p>
) : undefined}
- {/* {activeCollection?.subCollections &&
- activeCollection?.subCollections.length > 0 ? (
+ {/* {collections.some((e) => e.parentId === activeCollection.id) ? (
<fieldset className="border rounded-md p-2 border-neutral-content">
<legend className="text-sm ml-2">Sub-Collections</legend>
<div className="flex gap-3">
diff --git a/types/global.ts b/types/global.ts
index a8725166..3c8de79b 100644
--- a/types/global.ts
+++ b/types/global.ts
@@ -35,7 +35,6 @@ export interface CollectionIncludingMembersAndLinkCount
createdAt?: string;
_count?: { links: number };
members: Member[];
- subCollections: CollectionIncludingMembersAndLinkCount[];
}
export interface TagIncludingLinkCount extends Tag {