Overview
Context: NoteEditorScreen (app/lib/screens/note_editor_screen.dart) creates a note in the backend via AppState.createNote() as soon as the user taps the "New note" button — before the user has typed anything. The editor then auto-saves every 2 seconds via a debounce timer.
The problem: If the user taps "New note", immediately presses back without typing anything, a blank note with an empty title is saved to the backend and appears in the notes list. This clutters the list quickly.
What needs to be done
Goal
Tapping "New note" and immediately going back leaves zero notes in the list. Only notes with at least a title or a single character of content are persisted.
Where to look
app/lib/screens/note_editor_screen.dart:
_NoteEditorScreenState — _titleController, _contentController, _autoSaveTimer, dispose()
- Look for
WillPopScope or PopScope if present, otherwise add one
app/lib/services/app_state.dart — deleteNote(id) already exists
Testing steps
Notes
This is a good first issue. The fix lives entirely in note_editor_screen.dart and app_state.dart with no backend changes needed.
Related to: #8, #11
Overview
Context:
NoteEditorScreen(app/lib/screens/note_editor_screen.dart) creates a note in the backend viaAppState.createNote()as soon as the user taps the "New note" button — before the user has typed anything. The editor then auto-saves every 2 seconds via a debounce timer.The problem: If the user taps "New note", immediately presses back without typing anything, a blank note with an empty title is saved to the backend and appears in the notes list. This clutters the list quickly.
What needs to be done
_NoteEditorScreenState.dispose()(or in the back-navigation handler), check whether both the title and the content are still empty (or contain only whitespace)AppState.deleteNote(noteId)before popping the screen_MobileLayoutinhome_screen.dart), ensure the FAB creates the note correctly so the same discard logic appliesGoal
Tapping "New note" and immediately going back leaves zero notes in the list. Only notes with at least a title or a single character of content are persisted.
Where to look
app/lib/screens/note_editor_screen.dart:_NoteEditorScreenState—_titleController,_contentController,_autoSaveTimer,dispose()WillPopScopeorPopScopeif present, otherwise add oneapp/lib/services/app_state.dart—deleteNote(id)already existsTesting steps
Notes
Related to: #8, #11