Save Note Popup displays even when none of the note content is modified #211
Labels
bug
Something isn't working
ready for development
There is a clear solution which can be implemented
When I tap a note and view it, then try to go back it pops up a 'you have unsaved changes' popup.
ref issue: #209
This is the code used for showing unsaved changes popup in
note_create_page.dart
ornote_read_only_page.dart
,NotesBloc
stores the state of currently opened note.NoteInitialState
is the initial state and controller parameter holds the rich text editor's internal state. It will only be transitioned toNoteUpdatedState
whentitle
,createdAt
,allNoteAssets
ortags
is updated. But if user types something into rich text editor without changing any of these, the state will still remain as NoteInitialState as controller takes care of managing rich text editor's state internally. So there's no way to distinguish if an actual edit has happened in such cases.Solution:
When user clicks on back button in
note_create_page.dart
ornote_read_only_page.dart
, retrieve the note from database and compare it with the current note, if its different then only show the popup, otherwise pop the screen.There are multiple ways for comparing two notes, easiest one can be to compare
hash
property of notes which will be modified if any of the content is changed. RefersaveNote
method to know howhash
is updated when a note is changed.Relevant files:
The text was updated successfully, but these errors were encountered: