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 445B

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