react-scan icon indicating copy to clipboard operation
react-scan copied to clipboard

fix: add unique identifiers to tasks for accurate deletion

Open pradeepkaswan opened this issue 2 months ago • 3 comments

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 id to each task using Date.now().
  • TaskList and TaskItem Components: Updated to handle tasks with unique ids, ensuring accurate deletion.
  • State Management: Updated the tasks state to be an array of objects, each containing an id and text.

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

  1. Add multiple tasks with the same text.
  2. Delete tasks and verify that the correct task is removed.
  3. Ensure that the task list updates correctly after deletion.

Related Issue

Fixes #61

pradeepkaswan avatar Dec 02 '24 06:12 pradeepkaswan