ATlast — you'll never need to find your favorites on another platform again. Find your favs in the ATmosphere.
atproto

fix results card overlap with dynamic size estimation

byarielm.fyi 74116d43 4c3ae0db

verified
Changed files
+29 -2
src
+29 -2
src/components/VirtualizedResultsList.tsx
··· 26 26 const virtualizer = useVirtualizer({ 27 27 count: results.length, 28 28 getScrollElement: () => parentRef.current, 29 - estimateSize: () => 200, // Estimated height per item 30 - overscan: 5, // Render 5 extra items above/below viewport 29 + estimateSize: (index) => { 30 + const result = results[index]; 31 + const isExpanded = expandedResults.has(index); 32 + const matchCount = result.atprotoMatches.length; 33 + 34 + // Base height for source user header + padding 35 + let estimatedHeight = 80; 36 + 37 + if (matchCount === 0) { 38 + // No matches - just the "not found" message 39 + estimatedHeight += 100; 40 + } else { 41 + // Calculate height based on number of visible matches 42 + const visibleMatches = isExpanded ? matchCount : 1; 43 + 44 + // Each match item: ~120px base + potential description (~40px) 45 + // Assume ~30% of matches have descriptions 46 + const avgMatchHeight = 140; 47 + estimatedHeight += visibleMatches * avgMatchHeight; 48 + 49 + // Add space for "show more" button if there are hidden matches 50 + if (matchCount > 1) { 51 + estimatedHeight += 40; 52 + } 53 + } 54 + 55 + return estimatedHeight; 56 + }, 57 + overscan: 3, // Render 3 extra items above/below viewport (reduced from 5 for better performance) 31 58 }); 32 59 33 60 return (