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

Error while drag and drop a card in different lane

Open IamDixit opened this issue 5 years ago • 9 comments

Describe the bug Getting 'index.js:82 Uncaught TypeError: Cannot read property 'laneId' of undefined' error while card drag and drop functionality.

To Reproduce Steps to reproduce the behavior:

  1. updating my redux state when onCardMoveAcrossLanes() fires data

Desktop (please complete the following information):

  • OS: MacOS Mojave
  • Browser: chrome

Additional context I have my redux state which updates on card actions. Add card to lane, add lane, reorder lanes and rest functionality are working.

IamDixit avatar Oct 26 '19 17:10 IamDixit

I have the same issue, but in my case I use "getderivedstate" to map my business objects to "board ones". And when I move a card to a different lane I get this error, and the dnd feature stops working.

Let us know if you've found a solution please.

orlandovallejos avatar Nov 07 '19 00:11 orlandovallejos

ok, more information about this issue here: When I move tasks within the same lane everything works just fine, but when I move them to a different lane I get the error above.

orlandovallejos avatar Nov 07 '19 00:11 orlandovallejos

@orlandovallejos Same thing, man. I am trying to find a solution.

VadimZP avatar Dec 02 '19 16:12 VadimZP

onCardMoveAcrossLanes is not even called, but handleDragEnd works fine.

VadimZP avatar Dec 02 '19 18:12 VadimZP

Same thing here, someone already found the solution?

guifeliper avatar Dec 17 '19 20:12 guifeliper

Same here. Anyone found at least a workaround already?

MarioZ2002 avatar Feb 23 '20 11:02 MarioZ2002

ok, this is what I did (not the best solution, but it works for me)

I use the handleDragEnd method, and call my api to update my record on the database. But, I always return false! This will prevent the card to make the move, but I count on my state to be updated once the api returns a successful request. So, I get my state updated and the card is moved to the right position.

I told you it's not the best solution. But it works.

Here's some code:

<Board
   ...my other props here
   handleDragEnd={this.handleDragEnd}
/>
</Board>

And in my method:

handleDragEnd = (moveParamsFromThisComponent) => {
   // Call my action, it will make the api call, and eventually update my state in redux:

   // This will prevent to drop the task:
   return false;
};

orlandovallejos avatar Mar 24 '20 22:03 orlandovallejos

I am getting the same error, not using any callbacks right now just populating the cards from my API response. Also noticed that this does not happen with the cards created using the add new card button on the board

Looks similar to #66

sdabhi23 avatar Dec 31 '20 17:12 sdabhi23

I'm having this issue too. There is no workaround for this?

smarbos avatar Jan 18 '22 04:01 smarbos