JakeSidSmith / react-reorder

Drag & drop, touch enabled, reorderable / sortable list, React component
https://jakesidsmith.github.io/react-reorder/
MIT License
219 stars 58 forks source link

Less performant deeper in the dom? #102

Open patricktyndall opened 4 years ago

patricktyndall commented 4 years ago

Great component. Is there any reason why this would perform worse at higher dom depths?

Debugging some performance issues and removing divs so far has been the only solution (and performance issues roughly scale with how deep it is). Looking at dev tools performance tab, looks like all the time is spent in script and not rendering.

I'm returning another in the same component at a shallower depth and it's silky smooth (and removing this one doesn't affect the performance of the other).

My reorder:

<Reorder placeholder={<div className="placeholder"/>} lock="vertical" reorderId={`reorder-small`} onReorder={(ev, prevIdx, nextIdx) => onReorderPhotos(prevIdx, nextIdx)}>
    {
        photoUrls.map((url, idx) => (
            <div style={{ backgroundImage:`url(${url})` }} className={'reorder-item'} key={idx} >

            </div>
        ))
    }
</Reorder>

Sorry for limited info. I'm on 3.0.0-alpha.7. Thanks!

JakeSidSmith commented 3 years ago

Hi, do you mean the further down your DOM tree reorder is rendered the laggier it is? Is reorder updating state that is much further up the tree? Could you perhaps put together a full example?