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
fix(sql_console): runtime error for inline title
Elian Doran52ed1750ac53
diff --git a/apps/client/src/widgets/layout/InlineTitle.tsx b/apps/client/src/widgets/layout/InlineTitle.tsxindex b0e7e4e8a5..9070902535 100644--- a/apps/client/src/widgets/layout/InlineTitle.tsx+++ b/apps/client/src/widgets/layout/InlineTitle.tsx@@ -23,12 +23,12 @@ const supportedNoteTypes = new Set<NoteType>([export default function InlineTitle() {const { note, parentComponent, viewScope } = useNoteContext();const type = useNoteProperty(note, "type");- const [ shown, setShown ] = useState(shouldShow(note?.noteId, type, viewScope));+ const [ shown, setShown ] = useState(shouldShow(note, type, viewScope));const containerRef = useRef<HTMLDivElement>(null);const [ titleHidden, setTitleHidden ] = useState(false);useLayoutEffect(() => {- setShown(shouldShow(note?.noteId, type, viewScope));+ setShown(shouldShow(note, type, viewScope));}, [ note, type, viewScope ]);useLayoutEffect(() => {@@ -70,10 +70,10 @@ export default function InlineTitle() {);}-function shouldShow(note: FNote, type: NoteType | undefined, viewScope: ViewScope | undefined) {+function shouldShow(note: FNote | null | undefined, type: NoteType | undefined, viewScope: ViewScope | undefined) {if (viewScope?.viewMode !== "default") return false;- if (note.noteId?.startsWith("_options")) return true;- if (note.isTriliumSqlite()) return false;+ if (note?.noteId?.startsWith("_options")) return true;+ if (note?.isTriliumSqlite()) return false;return type && supportedNoteTypes.has(type);}