Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(layout/inline-title): not reacting to note type changes
Elian Dorana2b007874b38
diff --git a/apps/client/src/widgets/layout/InlineTitle.tsx b/apps/client/src/widgets/layout/InlineTitle.tsxindex 6dd0512a5c..62bdeab907 100644--- a/apps/client/src/widgets/layout/InlineTitle.tsx+++ b/apps/client/src/widgets/layout/InlineTitle.tsx@@ -25,12 +25,13 @@ const supportedNoteTypes = new Set<NoteType>([export default function InlineTitle() {const { note, parentComponent, viewScope } = useNoteContext();- const [ shown, setShown ] = useState(shouldShow(note, viewScope));+ const type = useNoteProperty(note, "type");+ const [ shown, setShown ] = useState(shouldShow(note?.noteId, type, viewScope));const containerRef= useRef<HTMLDivElement>(null);useEffect(() => {- setShown(shouldShow(note, viewScope));- }, [ note, viewScope ]);+ setShown(shouldShow(note?.noteId, type, viewScope));+ }, [ note, type, viewScope ]);useEffect(() => {if (!shown) return;@@ -69,11 +70,10 @@ export default function InlineTitle() {);}-function shouldShow(note: FNote | null | undefined, viewScope: ViewScope | undefined) {- if (!note) return false;+function shouldShow(noteId: string | undefined, type: NoteType | undefined, viewScope: ViewScope | undefined) {if (viewScope?.viewMode !== "default") return false;- if (note.noteId.startsWith("_options")) return true;- return supportedNoteTypes.has(note.type);+ if (noteId?.startsWith("_options")) return true;+ return type && supportedNoteTypes.has(type);}//#region Title details