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
Memory leak #781
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found a function called cloneLayoutItem in the source code that uses JSON.parse(JSON.stringify). Normally, there shouldn't be any issues with this approach. However, when dragging elements and having a large amount of data in the layout, it can lead to a memory spike. I would like the author to optimize this aspect.
Code:
function cloneLayoutItem(layoutItem
/: LayoutItem/
)
/: LayoutItem/
{
/return {
w: layoutItem.w, h: layoutItem.h, x: layoutItem.x, y: layoutItem.y, i: layoutItem.i,
minW: layoutItem.minW, maxW: layoutItem.maxW, minH: layoutItem.minH, maxH: layoutItem.maxH,
moved: Boolean(layoutItem.moved), static: Boolean(layoutItem.static),
// These can be null
isDraggable: layoutItem.isDraggable, isResizable: layoutItem.isResizable
};/
return JSON.parse(JSON.stringify(layoutItem));
}
Please optimize the code to address the memory issue caused by excessive data in the layout when dragging elements.
The text was updated successfully, but these errors were encountered: