Parcourir la source

fix(app): more defensive dom access

Adam il y a 1 mois
Parent
commit
6da60bd5d9
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      packages/ui/src/components/list.tsx

+ 1 - 1
packages/ui/src/components/list.tsx

@@ -67,7 +67,7 @@ export function List<T>(props: ListProps<T> & { ref?: (ref: ListRef) => void })
     if (!props.current) return
     if (!props.current) return
     const key = props.key(props.current)
     const key = props.key(props.current)
     requestAnimationFrame(() => {
     requestAnimationFrame(() => {
-      const element = scrollRef()!.querySelector(`[data-key="${key}"]`)
+      const element = scrollRef()?.querySelector(`[data-key="${key}"]`)
       element?.scrollIntoView({ block: "center" })
       element?.scrollIntoView({ block: "center" })
     })
     })
   })
   })