Giter VIP home page Giter VIP logo

taskease's People

Contributors

1plam avatar

Watchers

 avatar

taskease's Issues

Unable to read property 'id' when dragging tasks.

Issue Description:

When attempting to drag tasks within the project board, users encounter a TypeError: "Cannot read properties of undefined (reading 'id')" error. This issue arises due to the 'id' property in the 'user' object being undefined. The task's data is derived from the UpdateBoardTaskRequest interface, which includes both 'user' and 'userId' properties.

Steps to Reproduce:

  1. Navigate to the project board.
  2. Attempt to drag a task from one column to another.

Expected Behavior:
The task should be draggable without any errors, and the 'id' property in the 'user' object should be accessible.

Actual Behavior:
Dragging tasks results in a TypeError due to the 'id' property in the 'user' object being undefined.

Proposed Solution:

To resolve this issue, we need to implement additional checks in the drop method of the project board component. Specifically, we need to ensure that the 'user' object is defined and has a valid 'id' property before accessing it. This will allow us to set the 'userId' based on the 'user.id' if available and avoid accessing undefined properties.

Additional Information:
Error Code: Uncaught (in promise): TypeError: Cannot read properties of undefined (reading 'id')

Issue occurrance:

async drop(event: CdkDragDrop<BoardTask[]>) {
  if (event.previousContainer === event.container) {
    moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
  } else {
    transferArrayItem (
        event.previousContainer.data,
        event.container.data,
        event.previousIndex,
        event.currentIndex
    );

    const droppedTask: UpdateBoardTaskRequest = event.item.data;
    droppedTask.status = this.status;

    const indexToReplace = this.filteredBoardTasks.findIndex(task => task.id === droppedTask.id);
    this.filteredBoardTasks[indexToReplace] = {...droppedTask, userId: droppedTask.user.id};

    await this.boardTaskService.updateBoardTask(droppedTask);
  }
}

Impact:

This issue affects users trying to manage tasks within the project board. The error prevents smooth task movement and may cause confusion and frustration.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.