Skip to content

Commit 58a90b9

Browse files
committed
Rename lane components and adjust resize observer debounce timing
1 parent 4f05dd8 commit 58a90b9

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

examples/react/lanes/src/main.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ function App() {
1717
<br />
1818

1919
<h3>Lanes</h3>
20-
<LanesVirtualizer />
20+
<LanesGapVirtualizer />
2121
<br />
2222
<br />
23-
<h3>Padding Lanes</h3>
24-
<PaddingVirtualizer />
23+
<h3>Lanes Gaps</h3>
24+
<GapVirtualizer />
2525
<br />
2626
<br />
27-
<h3>Resizable Lanes</h3>
27+
<h3>Resizable Container Lanes</h3>
2828
<ResizeVirtualizer />
2929
<br />
3030
<br />
@@ -41,7 +41,7 @@ function App() {
4141
)
4242
}
4343

44-
function LanesVirtualizer() {
44+
function LanesGapVirtualizer() {
4545
const [numLanes, setNumLanes] = React.useState(4)
4646
const parentRef = React.useRef(null)
4747

@@ -98,7 +98,7 @@ function LanesVirtualizer() {
9898
)
9999
}
100100

101-
function PaddingVirtualizer() {
101+
function GapVirtualizer() {
102102
const parentRef = React.useRef<HTMLDivElement>(null)
103103
const [numLanes, setNumLanes] = React.useState(4)
104104
const [rowGap, setRowGap] = React.useState(10)
@@ -184,14 +184,15 @@ function ResizeVirtualizer() {
184184

185185
React.useEffect(() => {
186186
if (!parentRef.current) return
187-
const debouncedOnResize = debounce((entries: Array<ResizeObserverEntry>) => {
187+
// debounce not necessary
188+
const debouncedOnResize = debounce((entries: Array<ResizeObserverEntry>) => {
188189
const rect = entries.at(0)?.contentRect
189190
if (!rect) return
190191
const { width } = rect
191192
setNumLanes(Math.floor(width / CELL_WIDTH))
192193
rowVirtualizer.measure()
193194
}, {
194-
wait: 100,
195+
wait: 50,
195196

196197
})
197198
const resizeObserver = new ResizeObserver((entries) => {

0 commit comments

Comments
 (0)