fix(web): keep workspace options when expanding lineage (#16635)

This commit is contained in:
maria authored and GitHub committed 2026-10-06 22:32:14 -03:00
1 parent 2991331515
commit 847c53df01
1 file changed
+21 -4
@@ -53,6 +53,7 @@ export function ThreadDetailsCard({
const [measurements, setMeasurements] = useState({
key: measurementKey,
heights: { full: 0, compact: 0 },
fullContentHeight: 0,
});
const contentHeights =
measurements.key === measurementKey ? measurements.heights : { full: 0, compact: 0 };
@@ -64,8 +65,8 @@ export function ThreadDetailsCard({
? preferredPlacement.x + preferredPlacement.width
: undefined;
const cardBottom =
preferredPlacement && contentHeights.full > 0
? preferredPlacement.y + Math.min(contentHeights.full, preferredPlacement.height)
preferredPlacement && measurements.key === measurementKey && measurements.fullContentHeight > 0
? preferredPlacement.y + Math.min(measurements.fullContentHeight, preferredPlacement.height)
: undefined;
useLayoutEffect(() => {
reportDetailsCard?.(
@@ -88,11 +89,27 @@ export function ThreadDetailsCard({
const measure = () => {
const frame = element.closest<HTMLElement>("[data-thread-details-card]");
const next = element.offsetHeight + (frame ? frame.offsetHeight - frame.clientHeight : 0);
// Lineage scrolls as it expands. Counting it toward density would hide
// the section and workspace controls when the user asks to see more rows.
const lineage = element.querySelector<HTMLElement>("[data-thread-relationships-panel]");
const fittingHeight = next - (lineage?.offsetHeight ?? 0);
setMeasurements((current) => {
const heights = current.key === measurementKey ? current.heights : { full: 0, compact: 0 };
return current.key === measurementKey && heights[density] === next
const fullContentHeight =
density === "full"
? next
: current.key === measurementKey
? current.fullContentHeight
: 0;
return current.key === measurementKey &&
heights[density] === fittingHeight &&
current.fullContentHeight === fullContentHeight
? current
: { key: measurementKey, heights: { ...heights, [density]: next } };
: {
key: measurementKey,
heights: { ...heights, [density]: fittingHeight },
fullContentHeight,
};
});
};
measure();