From a2b007874b38f26ba0b8167f2a1c9f46eb2f8be2 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 13 Dec 2025 12:43:15 +0200 Subject: [PATCH] feat(layout/inline-title): not reacting to note type changes --- apps/client/src/widgets/layout/InlineTitle.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/client/src/widgets/layout/InlineTitle.tsx b/apps/client/src/widgets/layout/InlineTitle.tsx index 6dd0512a5..62bdeab90 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([ 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(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