Skip to content

Commit a6ac789

Browse files
authored
Fix: Add null-safety checks to SearchModal IntersectionObserver
1 parent abf8e7a commit a6ac789

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/components/SearchModal.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,14 @@ function SearchResults({ focusedIndex }: { focusedIndex: number }) {
935935
const observer = new IntersectionObserver(
936936
(entries) => {
937937
entries.forEach((entry) => {
938-
if (entry.isIntersecting && !isLastPage) {
938+
// Add null-safety checks to prevent accessing properties on null refs
939+
// during component unmounting/navigation transitions
940+
if (
941+
entry.isIntersecting &&
942+
!isLastPage &&
943+
sentinelRef.current &&
944+
containerRef.current
945+
) {
939946
showMore()
940947
}
941948
})

0 commit comments

Comments
 (0)