From bc3dce6ecfdce09076baf672af39b8c9d7e519f1 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Sat, 23 Dec 2023 15:35:07 +0500 Subject: [PATCH] web: fix crash when note has no title --- apps/web/src/components/editor/title-box.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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(() => {