diff --git a/apps/client/src/widgets/collections/NoteList.tsx b/apps/client/src/widgets/collections/NoteList.tsx index 0a79b5720..1cc4fed1a 100644 --- a/apps/client/src/widgets/collections/NoteList.tsx +++ b/apps/client/src/widgets/collections/NoteList.tsx @@ -23,22 +23,27 @@ interface NoteListProps { isEnabled: boolean; ntxId: string | null | undefined; media: ViewModeMedia; + viewType: ViewTypeOptions | undefined; onReady?: () => void; } export default function NoteList(props: Pick) { const { note, noteContext, notePath, ntxId } = useNoteContext(); - const isEnabled = noteContext?.hasNoteList(); - return + const viewType = useNoteViewType(note); + const [ enabled, setEnabled ] = useState(noteContext?.hasNoteList()); + useEffect(() => { + setEnabled(noteContext?.hasNoteList()); + }, [ noteContext, viewType ]) + return } export function SearchNoteList(props: Omit) { - return + const viewType = useNoteViewType(props.note); + return } -export function CustomNoteList({ note, isEnabled: shouldEnable, notePath, highlightedTokens, displayOnlyCollections, ntxId, onReady, ...restProps }: NoteListProps) { +export function CustomNoteList({ note, viewType, isEnabled: shouldEnable, notePath, highlightedTokens, displayOnlyCollections, ntxId, onReady, ...restProps }: NoteListProps) { const widgetRef = useRef(null); - const viewType = useNoteViewType(note); const noteIds = useNoteIds(shouldEnable ? note : null, viewType, ntxId); const isFullHeight = (viewType && viewType !== "list" && viewType !== "grid"); const [ isIntersecting, setIsIntersecting ] = useState(false);