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
16 changes: 16 additions & 0 deletions src/components/dashboard/control-plane/ControlPlanePage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,22 @@ describe('ControlPlanePage', () => {
});
});

it('renders the newest pipeline event first without bottom autoscroll behavior', async () => {
mockFetchWithItems(PIPELINE_EVENTS);
render(
<DataSourceTestProvider client={qc}>
<ControlPlanePage config={{}} />
</DataSourceTestProvider>,
);

await waitFor(() => {
expect(screen.getAllByTestId('pipeline-log-entry')).toHaveLength(3);
});
expect(screen.getAllByTestId('pipeline-log-entry')[0]).toHaveTextContent(
/contract materialized/i,
);
});

it('shows delegation trigger in live data-source mode', async () => {
vi.stubEnv('VITE_DATA_SOURCE', 'http');
const source: ProtocolSnapshotSource = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function ControlPlanePage({
const projected = data ?? [];
return [...projected, ...localEvents].sort(
(a, b) =>
new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime(),
new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime(),
);
}, [data, localEvents]);

Expand Down
10 changes: 0 additions & 10 deletions src/components/dashboard/control-plane/PipelineLogStream.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useEffect, useRef } from 'react';
import { Text } from '@/components/ui/typography';

export interface PipelineEvent {
Expand Down Expand Up @@ -30,14 +29,6 @@ function formatTime(iso: string): string {
}

export function PipelineLogStream({ events }: { events: PipelineEvent[] }) {
const bottomRef = useRef<HTMLDivElement>(null);

useEffect(() => {
if (bottomRef.current && typeof bottomRef.current.scrollIntoView === 'function') {
bottomRef.current.scrollIntoView({ behavior: 'smooth' });
}
}, [events.length]);

return (
<div
style={{
Expand Down Expand Up @@ -106,7 +97,6 @@ export function PipelineLogStream({ events }: { events: PipelineEvent[] }) {
</div>
))
)}
<div ref={bottomRef} />
</div>
);
}
Loading