tldraw/hooks/useShapesToRender.ts

15 lines
432 B
TypeScript
Raw Normal View History

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