From a3651f1c96eb29d41657f84bff7d1c463705ed3a Mon Sep 17 00:00:00 2001 From: sepehr Date: Sat, 2 May 2026 19:54:45 +0200 Subject: [PATCH] fix: remove useEffect([note]) that was killing auto-save in NoteInlineEditor The useEffect synced local state from props but fired on every keystroke because onChange updates the parent, which creates a new note prop reference. This cleared the save timer and isDirty flag before auto-save could fire, making notes unsavable in tabs view. The key prop with updatedAt already handles the restore remount case. --- memento-note/components/note-inline-editor.tsx | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/memento-note/components/note-inline-editor.tsx b/memento-note/components/note-inline-editor.tsx index 127c362..4aa004f 100644 --- a/memento-note/components/note-inline-editor.tsx +++ b/memento-note/components/note-inline-editor.tsx @@ -139,22 +139,6 @@ export function NoteInlineEditor({ const [fusionNotes, setFusionNotes] = useState>>([]) const [comparisonNotes, setComparisonNotes] = useState>>([]) - const noteContentRef = useRef(note.content) - const noteTitleRef = useRef(note.title) - useEffect(() => { - if (note.content !== noteContentRef.current || note.title !== noteTitleRef.current) { - clearTimeout(saveTimerRef.current) - setIsDirty(false) - setTitle(note.title || '') - setContent(note.content || '') - setCheckItems(note.checkItems || []) - setNoteType(note.type) - pendingRef.current = { title: note.title || '', content: note.content || '', checkItems: note.checkItems || [], isMarkdown: note.type === 'markdown', noteType: note.type } - noteContentRef.current = note.content - noteTitleRef.current = note.title - } - }, [note]) - const changeTitle = (t: string) => { setTitle(t); onChange?.(note.id, { title: t }) } const changeContent = (c: string) => { setContent(c); onChange?.(note.id, { content: c }) } const changeCheckItems = (ci: CheckItem[]) => { setCheckItems(ci); onChange?.(note.id, { checkItems: ci }) }