Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: fix crash when note has no title

Abdullah Atta6d70f8d2f9b0
diff --git a/apps/web/src/components/editor/title-box.tsx b/apps/web/src/components/editor/title-box.tsx
index e4f88e536..0fb900a0e 100644
--- a/apps/web/src/components/editor/title-box.tsx
+++ b/apps/web/src/components/editor/title-box.tsx
@@ -61,10 +61,10 @@ function TitleBox(props: TitleBoxProps) {
);
useEffect(() => {
- const { title = "" } = useStore.getState().session;
+ const { title } = useStore.getState().session;
if (!inputRef.current) return;
- inputRef.current.value = title;
- updateFontSize(title.length);
+ inputRef.current.value = title || "";
+ updateFontSize(title?.length || 0);
}, [id, updateFontSize]);
useEffect(() => {