Skip to content

Commit 5ae7c8b

Browse files
committed
fix(web): exclude special lists from AddToListModal dropdown
Filter out system lists (History, Graph, Bookmarks) from the add-to-list modal. These special lists are auto-managed and shouldn't appear as options for manual entity addition. Previously, the modal would show an empty dropdown when only special lists existed. Now it shows the proper "no lists available" message, guiding users to create a list first.
1 parent 2de4b5d commit 5ae7c8b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

apps/web/src/components/catalogue/AddToListModal.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
import type { EntityType } from "@bibgraph/types";
6-
import { logger } from "@bibgraph/utils";
6+
import { logger, SPECIAL_LIST_IDS } from "@bibgraph/utils";
77
import {
88
Alert,
99
Button,
@@ -21,6 +21,9 @@ import React, { useState } from "react";
2121
import { ICON_SIZE } from '@/config/style-constants';
2222
import { useCatalogue } from "@/hooks/useCatalogue";
2323

24+
// Set of special list IDs that shouldn't be shown in the add-to-list modal
25+
const SPECIAL_LIST_ID_SET: Set<string> = new Set(Object.values(SPECIAL_LIST_IDS));
26+
2427

2528
interface AddToListModalProps {
2629
entityType: EntityType;
@@ -40,9 +43,14 @@ export const AddToListModal = ({
4043
const [notes, setNotes] = useState("");
4144
const [isSubmitting, setIsSubmitting] = useState(false);
4245

43-
// Filter lists based on entity type
46+
// Filter lists based on entity type and exclude special system lists
4447
// Bibliographies can only contain works
48+
// Special lists (History, Graph, Bookmarks) should not appear in add-to-list modal
4549
const availableLists = lists.filter(list => {
50+
// Exclude special system lists
51+
if (list.id && SPECIAL_LIST_ID_SET.has(list.id)) {
52+
return false;
53+
}
4654
if (list.type === "bibliography") {
4755
return entityType === "works";
4856
}

0 commit comments

Comments
 (0)