2021-05-09 21:22:25 +00:00
|
|
|
import { useSelector } from "state"
|
|
|
|
import { deepCompareArrays } from "utils/utils"
|
|
|
|
import Shape from "./shape"
|
|
|
|
|
|
|
|
/*
|
|
|
|
On each state change, compare node ids of all shapes
|
|
|
|
on the current page. Kind of expensive but only happens
|
|
|
|
here; and still cheaper than any other pattern I've found.
|
|
|
|
*/
|
|
|
|
|
|
|
|
export default function Page() {
|
2021-05-15 21:04:28 +00:00
|
|
|
const currentPageShapeIds = useSelector(
|
|
|
|
({ data }) => Object.keys(data.document.pages[data.currentPageId].shapes),
|
|
|
|
deepCompareArrays
|
|
|
|
)
|
2021-05-09 21:22:25 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{currentPageShapeIds.map((shapeId) => (
|
|
|
|
<Shape key={shapeId} id={shapeId} />
|
|
|
|
))}
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|