add notes from local storage after deletion of a note that would break the ids order
Opened this issue · 1 comments
LizChe commented
How to recreate the bug:
- Add two or more notes,
- Delete any but the last one,
- Refresh the page;
It seems that when addNotesFromLocalStorage function called, it checks the size of the notes, then starts to iterate starting from index 0. If the first note under such index is deleted and the first id is now 1, it will give an undefined error because there is no element under id = 0;
LizChe commented
The issue lies in the deleteNote method: delete notes[key] doesn't reindex the object of objects, leaving deleted objects as undefined.