Browse Source

fix(profiling): bounds check (#43799)

Perform a proper bounds check for end of array
Jonas 2 years ago
parent
commit
bdee3f8a37

+ 4 - 1
static/app/utils/profiling/hooks/useVirtualizedTree/useVirtualizedTree.tsx

@@ -440,7 +440,10 @@ export function useVirtualizedTree<T extends TreeLike>(
           const nextIndex = indexInVisibleItems + 1;
 
           // Bounds check if we are at end of list
-          if (nextIndex > latestTreeRef.current.flattened.length - 1) {
+          if (
+            latestStateRef.current.selectedNodeIndex ===
+            latestTreeRef.current.flattened.length - 1
+          ) {
             return;
           }