| ... | ... | @@ -53,6 +53,7 @@ export function ThreadDetailsCard({ |
| 53 | 53 | const [measurements, setMeasurements] = useState({ |
| 54 | 54 | key: measurementKey, |
| 55 | 55 | heights: { full: 0, compact: 0 }, |
| 56 | fullContentHeight: 0, |
| 56 | 57 | }); |
| 57 | 58 | const contentHeights = |
| 58 | 59 | measurements.key === measurementKey ? measurements.heights : { full: 0, compact: 0 }; |
| ... | ... | @@ -64,8 +65,8 @@ export function ThreadDetailsCard({ |
| 64 | 65 | ? preferredPlacement.x + preferredPlacement.width |
| 65 | 66 | : undefined; |
| 66 | 67 | const cardBottom = |
| 67 | | preferredPlacement && contentHeights.full > 0 |
| 68 | | ? preferredPlacement.y + Math.min(contentHeights.full, preferredPlacement.height) |
| 68 | preferredPlacement && measurements.key === measurementKey && measurements.fullContentHeight > 0 |
| 69 | ? preferredPlacement.y + Math.min(measurements.fullContentHeight, preferredPlacement.height) |
| 69 | 70 | : undefined; |
| 70 | 71 | useLayoutEffect(() => { |
| 71 | 72 | reportDetailsCard?.( |
| ... | ... | @@ -88,11 +89,27 @@ export function ThreadDetailsCard({ |
| 88 | 89 | const measure = () => { |
| 89 | 90 | const frame = element.closest<HTMLElement>("[data-thread-details-card]"); |
| 90 | 91 | const next = element.offsetHeight + (frame ? frame.offsetHeight - frame.clientHeight : 0); |
| 92 | // Lineage scrolls as it expands. Counting it toward density would hide |
| 93 | // the section and workspace controls when the user asks to see more rows. |
| 94 | const lineage = element.querySelector<HTMLElement>("[data-thread-relationships-panel]"); |
| 95 | const fittingHeight = next - (lineage?.offsetHeight ?? 0); |
| 91 | 96 | setMeasurements((current) => { |
| 92 | 97 | const heights = current.key === measurementKey ? current.heights : { full: 0, compact: 0 }; |
| 93 | | return current.key === measurementKey && heights[density] === next |
| 98 | const fullContentHeight = |
| 99 | density === "full" |
| 100 | ? next |
| 101 | : current.key === measurementKey |
| 102 | ? current.fullContentHeight |
| 103 | : 0; |
| 104 | return current.key === measurementKey && |
| 105 | heights[density] === fittingHeight && |
| 106 | current.fullContentHeight === fullContentHeight |
| 94 | 107 | ? current |
| 95 | | : { key: measurementKey, heights: { ...heights, [density]: next } }; |
| 108 | : { |
| 109 | key: measurementKey, |
| 110 | heights: { ...heights, [density]: fittingHeight }, |
| 111 | fullContentHeight, |
| 112 | }; |
| 96 | 113 | }); |
| 97 | 114 | }; |
| 98 | 115 | measure(); |