refactor(collections): delete unnecessary type parameter

This commit is contained in:
Elian Doran 2025-10-15 18:49:06 +03:00
parent d9906a4a47
commit e0e791d9b4
No known key found for this signature in database

View File

@ -13,7 +13,7 @@ import { subscribeToMessages, unsubscribeToMessage as unsubscribeFromMessage } f
import { WebSocketMessage } from "@triliumnext/commons"; import { WebSocketMessage } from "@triliumnext/commons";
import froca from "../../services/froca"; import froca from "../../services/froca";
interface NoteListProps<T extends object> { interface NoteListProps {
note: FNote | null | undefined; note: FNote | null | undefined;
notePath: string | null | undefined; notePath: string | null | undefined;
highlightedTokens?: string[] | null; highlightedTokens?: string[] | null;
@ -23,17 +23,17 @@ interface NoteListProps<T extends object> {
ntxId: string | null | undefined; ntxId: string | null | undefined;
} }
export default function NoteList<T extends object>(props: Pick<NoteListProps<T>, "displayOnlyCollections">) { export default function NoteList<T extends object>(props: Pick<NoteListProps, "displayOnlyCollections">) {
const { note, noteContext, notePath, ntxId } = useNoteContext(); const { note, noteContext, notePath, ntxId } = useNoteContext();
const isEnabled = noteContext?.hasNoteList(); const isEnabled = noteContext?.hasNoteList();
return <CustomNoteList note={note} isEnabled={!!isEnabled} notePath={notePath} ntxId={ntxId} {...props} /> return <CustomNoteList note={note} isEnabled={!!isEnabled} notePath={notePath} ntxId={ntxId} {...props} />
} }
export function SearchNoteList<T extends object>(props: Omit<NoteListProps<T>, "isEnabled">) { export function SearchNoteList<T extends object>(props: Omit<NoteListProps, "isEnabled">) {
return <CustomNoteList {...props} isEnabled={true} /> return <CustomNoteList {...props} isEnabled={true} />
} }
function CustomNoteList<T extends object>({ note, isEnabled: shouldEnable, notePath, highlightedTokens, displayOnlyCollections, ntxId }: NoteListProps<T>) { function CustomNoteList<T extends object>({ note, isEnabled: shouldEnable, notePath, highlightedTokens, displayOnlyCollections, ntxId }: NoteListProps) {
const widgetRef = useRef<HTMLDivElement>(null); const widgetRef = useRef<HTMLDivElement>(null);
const viewType = useNoteViewType(note); const viewType = useNoteViewType(note);
const noteIds = useNoteIds(note, viewType, ntxId); const noteIds = useNoteIds(note, viewType, ntxId);