-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Performances degrade with 200+ draggables #116
Comments
Are you iterating over your entire lists of draggables on each drag, possibly many times? |
Worth investigating why this occurs. I suspect it is because the draggable re-renders which causes all the children to render. So a simple thing to do would be to add a check in your You could create a child of your Another option would be to make your components that wrap your This is my suspicion as to what is causing the issue - but we would need to investigate more. |
Hi Alex, I've done as you've suggested but with no joy. I originally had everything on the same big component and I've actually noticed that the .map on my sources array was getting called several times (although the render was getting called only once) so I've extrapolated the droppable logic into a separate pure component and applied the shouldComponentUpdate logic you've suggested. over 226 items I have a very few milliseconds improvement but the user perceived performances are basically the same as the video I've posted in the original thread. here my code: /Main Component:/ /* Interfaces and Types */ export interface DnDState{ export class DnDTwoLists extends React.Component<DnDProps, DnDState> { onDragStart(initial: any){
} /Draggable Component:/ `import * as React from 'react' export interface DnDDraggableProps{ export class DnDDraggable extends React.PureComponent<DnDDraggableProps, {}> { shouldComponentUpdate(nextProps: DnDDraggableProps){ render(){
} }` |
I tried, unfortunately to no avail. |
@OmriAharon please post a webpack bin with your scenario. Here is a basic example to start with: https://www.webpackbin.com/bins/-Kr9aE9jnUeWlphY8wsw Looking at all the code pasted it is hard to know what is going on |
Just to clarify: When you drag over a Your |
Unfortunately the library itself cannot apply this logic - it is a restriction of the |
Thanks @alexreardon. The code above is not my own, I'm aware it's not feasible to track something like this. In your suggested WebpackBin, I tried simply with 1000 items which is stuck (I know it's a lot, that's the case in my app). I'll keep trying to do as you suggest in my app and come up with a solution. |
Hi Alex, All, I've tried with this with no joy, am I doing it wrong? even on the basic scenarion |
Well first of all thanks for replying and keeping up with my issue guys, I really think the lib does a great job. |
@varHarrie Would really like to see a webpackbin of your successful scenario. |
I misunderstood the initial issue. I thought it was related to moving into a new list. It is actually: "A draggable has a delay of half a second when first clicked&dragged around" This is already being tracked here: #86 |
ScreenCapture_1.mp4.zip
Bug or feature request?
Bug?
Expected behaviour
I have noticed that with over 200 items in a Droppable, performances degrades a lot, especially when dragging between Droppables.
Actual behaviour
A draggable has a delay of half a second when first clicked&dragged around
Browser version
Chrome latest version
###DEMO
see attached
The text was updated successfully, but these errors were encountered: