Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add notes from local storage after deletion of a note that would break the ids order #4

Open
3 tasks
LizChe opened this issue Jun 18, 2019 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@LizChe
Copy link
Owner

LizChe commented Jun 18, 2019

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 LizChe added the bug Something isn't working label Jun 18, 2019
@LizChe LizChe self-assigned this Jun 18, 2019
@LizChe
Copy link
Owner Author

LizChe commented Jun 18, 2019

The issue lies in the deleteNote method: delete notes[key] doesn't reindex the object of objects, leaving deleted objects as undefined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant