A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: fix editor title not updating on creating a note
Abdullah Attab54457f522b9
diff --git a/apps/web/src/components/editor/title-box.tsx b/apps/web/src/components/editor/title-box.tsxindex a642e0793..b4957e3dd 100644--- a/apps/web/src/components/editor/title-box.tsx+++ b/apps/web/src/components/editor/title-box.tsx@@ -37,6 +37,7 @@ function TitleBox(props: TitleBoxProps) {const { readonly, id } = props;const inputRef = useRef<HTMLInputElement>(null);// const id = useStore((store) => store.session.id);+ const sessionType = useEditorStore((store) => store.getActiveSession()?.type);const isMobile = useMobile();const isTablet = useTablet();const { editorConfig } = useEditorConfig();@@ -62,13 +63,16 @@ function TitleBox(props: TitleBoxProps) {useEffect(() => {const session = useEditorStore.getState().getSession(id);- if (!session || !("note" in session) || !session.note) return;+ if (!session || !("note" in session) || !session.note || !inputRef.current)+ return;const { title } = session.note;- if (!inputRef.current) return;- inputRef.current.value = title || "";+ withSelectionPersist(+ inputRef.current,+ (input) => (input.value = title || "")+ );updateFontSize(title?.length || 0);- }, [id, updateFontSize]);+ }, [sessionType, id, updateFontSize]);useEffect(() => {if (!inputRef.current) return;