You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

useShape.ts 501B

1234567891011121314151617181920
  1. /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
  2. import { useSelector } from 'state'
  3. import { getShapeUtils } from 'state/shape-utils'
  4. import { getShape } from 'utils'
  5. export default function useShapeDef(id: string) {
  6. return useSelector(
  7. (s) => getShape(s.data, id),
  8. (prev, next) => {
  9. const shouldSkip = !(
  10. prev &&
  11. next &&
  12. next !== prev &&
  13. getShapeUtils(next).shouldRender(next, prev)
  14. )
  15. return shouldSkip
  16. }
  17. )
  18. }