Skip to content

Commit 8a7fc4d

Browse files
author
waleed
committed
ack PR comments
1 parent 433b73a commit 8a7fc4d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

apps/sim/app/workspace/[workspaceId]/logs/executions-dashboard.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,18 +530,25 @@ export default function ExecutionsDashboard() {
530530
useEffect(() => {
531531
if (!barsAreaRef.current) return
532532
const el = barsAreaRef.current
533+
let debounceId: any = null
533534
const ro = new ResizeObserver(([entry]) => {
534535
const w = entry?.contentRect?.width || 720
535536
const n = Math.max(36, Math.min(96, Math.floor(w / MIN_SEGMENT_PX)))
536-
setSegmentCount(n)
537+
if (debounceId) clearTimeout(debounceId)
538+
debounceId = setTimeout(() => {
539+
setSegmentCount(n)
540+
}, 150)
537541
})
538542
ro.observe(el)
539543
const rect = el.getBoundingClientRect()
540544
if (rect?.width) {
541545
const n = Math.max(36, Math.min(96, Math.floor(rect.width / MIN_SEGMENT_PX)))
542546
setSegmentCount(n)
543547
}
544-
return () => ro.disconnect()
548+
return () => {
549+
if (debounceId) clearTimeout(debounceId)
550+
ro.disconnect()
551+
}
545552
}, [])
546553

547554
const getShiftLabel = () => {

0 commit comments

Comments
 (0)