Skip to content

Commit e6e41ae

Browse files
committed
feat: use new StickyList and reverse log list
1 parent 89f9858 commit e6e41ae

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/components/DomEvents.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import usePlayground from '../hooks/usePlayground';
66
import state from '../lib/state';
77
import { eventMap } from '@testing-library/dom/dist/event-map';
88
import { VirtualScrollable } from './Scrollable';
9-
import { FixedSizeList as List } from 'react-window';
109
import throttle from 'lodash.throttle';
1110
import AutoSizer from 'react-virtualized-auto-sizer';
1211
import IconButton from './IconButton';
1312
import TrashcanIcon from './TrashcanIcon';
1413
import EmptyStreetImg from '../images/EmptyStreetImg';
14+
import StickyList from './StickyList';
1515

1616
function onStateChange({ markup, query, result }) {
1717
state.save({ markup, query });
@@ -133,9 +133,8 @@ function DomEvents() {
133133
if (!node) return;
134134

135135
addLoggingEvents(node, (event) => {
136-
// insert at index 0
137136
event.id = buffer.current.length;
138-
buffer.current.splice(0, 0, event);
137+
buffer.current.push(event);
139138
setTimeout(flush, 0);
140139
});
141140
}, []);
@@ -185,7 +184,9 @@ function DomEvents() {
185184
) : (
186185
<AutoSizer>
187186
{({ width, height }) => (
188-
<List
187+
<StickyList
188+
follow={true}
189+
mode="bottom"
189190
ref={listRef}
190191
height={height}
191192
itemCount={eventCount}
@@ -195,7 +196,7 @@ function DomEvents() {
195196
outerElementType={VirtualScrollable}
196197
>
197198
{EventRecord}
198-
</List>
199+
</StickyList>
199200
)}
200201
</AutoSizer>
201202
)}

0 commit comments

Comments
 (0)