tldraw/hooks/useShapesToRender.ts
Steve Ruiz d1a3860bb1 Fixes a perf-killing deepCompare in context menu
Was deep comparing an array of actual selected shapes, rather than selected shape ids
2021-06-27 10:07:20 +01:00

13 lines
409 B
TypeScript

import { useSelector } from 'state'
import { getShapeUtils } from 'state/shape-utils'
import { deepCompareArrays, getPage } from 'utils'
export default function useShapesToRender(): string[] {
return useSelector(
(s) =>
Object.values(getPage(s.data).shapes)
.filter((shape) => shape && !getShapeUtils(shape).isForeignObject)
.map((shape) => shape.id),
deepCompareArrays
)
}