Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dragging a card over a lane re-renders all the cards in that lane #660

Closed
aditigoel23 opened this issue Jul 24, 2018 · 3 comments
Closed

Comments

@aditigoel23
Copy link

Bug or feature request?

Neither. Question on the performance note here - https://github.com/atlassian/react-beautiful-dnd#recommended-droppable-performance-optimisation.

Example - https://codesandbox.io/s/z3p2825z93

When I drag the card from 1st lane over the second (not dropping it yet), all the cards cards in lane 2 re-render.
As suggested in the help doc I have a shouldComponentUpdate on the cardsList.
I added console logs to render methods of the cardsList and card itself. While the cardsList re-render is blocked by the shouldComponentUpdate, the cards in the lane still re-render. It looks like the Draggable may be causing a state change internally and the card gets a change in the style prop.
Is this expected?

Steps to reproduce

See example https://codesandbox.io/s/z3p2825z93.
Drag the card called item 10 over the other lane. Note in the console that every card in the second lane re-renders.

What version of React are you using?

16.3.2

What version of react-beautiful-dnd are you running?

8.0.3

What browser are you using?

Chrome

Demo

https://codesandbox.io/s/z3p2825z93.

@alexreardon
Copy link
Collaborator

You will notice that only a subset of the draggables are rendering in the second list when you drag over it. These are the draggables that need to move out of the way in response to the new item entering the list. items 26+ do not have their render function called as they do not need to move.

Your should component update check is working as expected 👍

I added some more logging:
https://codesandbox.io/s/8480wr4jw8

@alexreardon
Copy link
Collaborator

If you had this concern, other people will too. I'll add a note in the docs about this

@aditigoel23
Copy link
Author

Thanks!

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

No branches or pull requests

2 participants