Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,32 @@ it("snap-syncs the timeline height when older rows are prepended", () => {
expect(heightWrapper?.style.height).toBe("400px");
expect(heightWrapper?.style.transitionDuration).toBe("0s");
});

it("snaps active timeline growth on fine-pointer browsers", () => {
vi.stubGlobal("ResizeObserver", ResizeObserverStub);
vi.stubGlobal("CSS", { supports: () => true });
const queryClient = new QueryClient();
const rows = [turnRow({ id: "active_turn", seq: 1, status: "pending" })];
const timeline = (active: boolean) => (
<MemoryRouter>
<QueryClientProvider client={queryClient}>
<ThreadTimelineRows
threadId="thr_main"
timelineRows={rows}
threadRuntimeDisplayStatus={active ? "active" : "idle"}
workspaceRootPath={undefined}
/>
</QueryClientProvider>
</MemoryRouter>
);
const view = render(timeline(false));
const rowList = view.container.querySelector<HTMLElement>(
'[data-timeline-row-list="top-level"]',
);
const wrapper = rowList?.parentElement?.parentElement;
expect(wrapper?.style.transition).toContain("height 180ms");
view.rerender(timeline(true));
expect(wrapper?.style.transition).toContain("height 0ms");
view.rerender(timeline(false));
expect(wrapper?.style.transition).toContain("height 180ms");
});
Original file line number Diff line number Diff line change
Expand Up @@ -2168,7 +2168,10 @@ function ThreadTimelineRowsForTimelineView(props: ThreadTimelineRowsProps) {
<TimelineWindowingEnabledContext.Provider
value={props.timelineWindowingEnabled ?? false}
>
<AutoHeightContainer snapRevision={heightSnapRevision}>
<AutoHeightContainer
snapRevision={heightSnapRevision}
animateGrowth={!scopeActive}
>
<TimelineRowsList
hasOlderTimelineRows={props.hasOlderTimelineRows}
isLoadingOlderTimelineRows={
Expand Down
5 changes: 4 additions & 1 deletion apps/app/src/components/ui/height-transition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ export function HeightTransition({ visible, children }: HeightTransitionProps) {
interface AutoHeightContainerProps {
children: ReactNode;
snapRevision?: string;
animateGrowth?: boolean;
}

const AUTO_HEIGHT_INITIAL_SETTLE_MS = 250;
Expand All @@ -228,9 +229,11 @@ function useSnapHeightGrowth(): boolean {
export function AutoHeightContainer({
children,
snapRevision,
animateGrowth = true,
}: AutoHeightContainerProps) {
const snapGrowth = useSnapHeightGrowth();
const durationMs = snapGrowth ? 0 : HEIGHT_TRANSITION_DURATION_MS;
const durationMs =
snapGrowth || !animateGrowth ? 0 : HEIGHT_TRANSITION_DURATION_MS;
const wrapperRef = useRef<HTMLDivElement>(null);
const innerRef = useRef<HTMLDivElement>(null);
const snapToCurrentHeightRef = useRef<(() => void) | null>(null);
Expand Down
Loading