Skip to content

Conversation

@time1043
Copy link

@time1043 time1043 commented Sep 29, 2025

Bug Description
Currently, new todo items use id: currentTodoList.length + 1 to generate IDs.
This causes duplicate IDs when an item is deleted and then a new one is added.

Reproduction steps:

  1. Delete an existing todo whose id is not 10 (id=10 which is "Rust").
  2. Add a new todo. The new todo gets the same id=10.
  3. When trying to delete that id, two items are removed at once.

See the attached screenshot for an example (two items with the same id=10: "Rust" and "aa").
Snipaste_2025-09-29_21-46-53

Solution
Ensure IDs are always unique when adding todos.
For simplicity, replace the ID generation with Date.now(), which guarantees uniqueness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant