fix: add unique identifiers to tasks for accurate deletion
Summary
This pull request addresses an issue where tasks with the same text could not be accurately deleted due to the lack of unique identifiers. By assigning a unique id to each task, we ensure that tasks can be correctly identified and managed.
Changes Made
-
AddTaskBar Component: Modified to assign a unique
idto each task usingDate.now(). -
TaskList and TaskItem Components: Updated to handle tasks with unique
ids, ensuring accurate deletion. -
State Management: Updated the
tasksstate to be an array of objects, each containing anidandtext.
Why This Change?
Previously, tasks were identified by their text value, leading to conflicts when tasks with the same text were added. This change ensures that each task has a unique identifier, allowing for accurate management and deletion of tasks.
How to Test
- Add multiple tasks with the same text.
- Delete tasks and verify that the correct task is removed.
- Ensure that the task list updates correctly after deletion.
Related Issue
Fixes #61
Someone is attempting to deploy a commit to the Million Team on Vercel.
A member of the Team first needs to authorize it.
Hey @pradeepkaswan :) I just saw Date.now() and If accurate and reliable timing is critical, performance.now() is the better choice 🚀
Hey @pradeepkaswan :) I just saw
Date.now()and If accurate and reliable timing is critical, performance.now() is the better choice 🚀
Thanks for the suggestion, @pivanov ! I have updated the timing function to use performance.now() for better accuracy. The changes have been pushed.