From 42cc1ffcd93e5a8a1ef80777008d451932b3b7ab Mon Sep 17 00:00:00 2001 From: drelich Date: Tue, 17 Mar 2026 00:19:45 +0100 Subject: [PATCH] Add debug logging for note deletion --- src/App.tsx | 13 +++++++++++-- src/components/NotesList.tsx | 2 ++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 4755be2..2009fac 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -147,11 +147,20 @@ function App() { }; const handleDeleteNote = async (note: Note) => { - if (!api) return; - if (!confirm(`Delete "${note.title}"?`)) return; + console.log('handleDeleteNote called for note:', note.id, note.title); + if (!api) { + console.log('No API instance'); + return; + } + + const confirmed = confirm(`Delete "${note.title}"?`); + console.log('User confirmed deletion:', confirmed); + if (!confirmed) return; try { + console.log('Calling API deleteNote...'); await api.deleteNote(note.id); + console.log('Note deleted successfully, updating state...'); setNotes(notes.filter(n => n.id !== note.id)); if (selectedNoteId === note.id) { setSelectedNoteId(notes[0]?.id || null); diff --git a/src/components/NotesList.tsx b/src/components/NotesList.tsx index 675b520..f9412cb 100644 --- a/src/components/NotesList.tsx +++ b/src/components/NotesList.tsx @@ -146,7 +146,9 @@ export function NotesList({