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
fix: title does not empty sometimes on new notes
thecodrr75b76d7747b7
diff --git a/apps/web/src/components/editor/title-box.tsx b/apps/web/src/components/editor/title-box.tsxindex 20be81b4b..1a10738f7 100644--- a/apps/web/src/components/editor/title-box.tsx+++ b/apps/web/src/components/editor/title-box.tsx@@ -1,4 +1,4 @@-import React, { useEffect, useState } from "react";+import React, { useEffect, useRef, useState } from "react";import { Input } from "@rebass/forms";import { useStore, store, SESSION_STATES } from "../../stores/editor-store";@@ -18,16 +18,19 @@ function TitleBox(props: TitleBoxProps) {const [placeholder, setPlaceholder] = useState<string>();useEffect(() => {- if (state === SESSION_STATES.new) {+ const noteTitle = store.get().session.title;+ if (state === SESSION_STATES.new && noteTitle !== currentTitle) {setCurrentTitle("");setPlaceholder("");} else if (state === SESSION_STATES.stale) {- setCurrentTitle(store.get().session.title);+ setCurrentTitle(noteTitle);}- }, [state]);+ // We do not want to update when currentTitle changes.+ }, [state, sessionId]);useEffect(() => {- setPlaceholder(title);+ if (currentTitle !== title) setPlaceholder(title);+ // We do not want to update when currentTitle changes.}, [title]);return (