Skip to content
Source
Sign inSign up
pingdotgg/t3code

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

Mergedmaria-rcksmerged 1 commit intomain fromrefs/pull/16635/headmerged by maria-rcks View on GitHub

Showing 1 changed file with 21 additions and 4 deletions.

x
0 of 1 viewed, 1 left
21 additions and 4 deletionsapps/web/src/components/chat/ThreadDetailsCard.tsxModified
View file
@@ -53,6 +53,7 @@
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 @@
? 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 @@
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) => {