fix: runtime error of null reading scrolIIntoView

This commit is contained in:
Andy Kenward
2023-05-16 22:16:24 +00:00
parent c6dfffe40e
commit ad8bf05c09

View File

@@ -46,7 +46,7 @@ const ContentAccordionLink = React.memo(function ContentAccordionLink(props: any
if (activeItem && activeItemRef.current) {
// this is a hack, but seems a common one on Stackoverflow
setTimeout(() => {
activeItemRef.current.scrollIntoView({ behavior: 'smooth', block: 'nearest' })
activeItemRef.current?.scrollIntoView({ behavior: 'smooth', block: 'nearest' })
}, 0)
}
})