From beac781596686784c60ef44d5184605ca4cd2523 Mon Sep 17 00:00:00 2001 From: Johnson Cherian Date: Tue, 19 Dec 2023 10:17:37 +0530 Subject: [PATCH] fix: filter hidden contens from grid render --- frontend/src/Editor/DragContainer.jsx | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/frontend/src/Editor/DragContainer.jsx b/frontend/src/Editor/DragContainer.jsx index 6152b34e9b..1e15f31f70 100644 --- a/frontend/src/Editor/DragContainer.jsx +++ b/frontend/src/Editor/DragContainer.jsx @@ -77,14 +77,20 @@ export default function DragContainer({ const moveableRef = useRef(); const childMoveableRefs = useRef([]); const [movableTargets, setMovableTargets] = useState({}); - const boxList = boxes.map((box) => ({ - id: box.id, - height: box?.layouts?.[currentLayout]?.height, - left: box?.layouts?.[currentLayout]?.left, - top: box?.layouts?.[currentLayout]?.top, - width: box?.layouts?.[currentLayout]?.width, - parent: box?.component?.parent, - })); + const boxList = boxes + .filter( + (box) => + box?.component?.definition?.others[currentLayout === 'mobile' ? 'showOnMobile' : 'showOnDesktop'].value === + '{{true}}' + ) + .map((box) => ({ + id: box.id, + height: box?.layouts?.[currentLayout]?.height, + left: box?.layouts?.[currentLayout]?.left, + top: box?.layouts?.[currentLayout]?.top, + width: box?.layouts?.[currentLayout]?.width, + parent: box?.component?.parent, + })); const [list, setList] = useState(boxList); console.log('draggedSubContainer => ', draggedSubContainer);