Skip to content

Build your personal knowledge base with Trilium Notes

fix(client/search): collection rendering twice

Elian Dorane904feb179cb
diff --git a/apps/client/src/components/note_context.ts b/apps/client/src/components/note_context.ts
index 79d1e148ba..d4bcb1fa61 100644
--- a/apps/client/src/components/note_context.ts
+++ b/apps/client/src/components/note_context.ts
@@ -326,9 +326,11 @@ class NoteContext extends Component implements EventListener<"entitiesReloaded">
}
// Collections must always display a note list, even if no children.
- const viewType = note.getLabelValue("viewType") ?? "grid";
- if (!["list", "grid"].includes(viewType)) {
- return true;
+ if (note.type === "book") {
+ const viewType = note.getLabelValue("viewType") ?? "grid";
+ if (!["list", "grid"].includes(viewType)) {
+ return true;
+ }
}
if (!note.hasChildren()) {
diff --git a/apps/client/src/widgets/collections/NoteList.tsx b/apps/client/src/widgets/collections/NoteList.tsx
index 76deeeffe3..e71aa09c91 100644
--- a/apps/client/src/widgets/collections/NoteList.tsx
+++ b/apps/client/src/widgets/collections/NoteList.tsx
@@ -85,7 +85,7 @@ export function CustomNoteList<T extends object>({ note, isEnabled: shouldEnable
}
return (
- <div ref={widgetRef} className={`note-list-widget component ${isFullHeight ? "full-height" : ""}`}>
+ <div ref={widgetRef} className={`note-list-widget component ${isFullHeight && isEnabled ? "full-height" : ""}`}>
{props && isEnabled && (
<div className="note-list-widget-content">
{getComponentByViewType(viewType, props)}