Skip to content
Open
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
11 changes: 8 additions & 3 deletions src/useLivelineEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -732,9 +732,14 @@ export function useLivelineEngine(
const rightEdge = now + windowSecs * buffer
const leftEdge = rightEdge - windowSecs

// Filter visible points — when pausing, contract right edge to `now`
// so new data (with real-time timestamps) can't appear past the live dot
const filterRight = rightEdge - (rightEdge - now) * pauseProgress
// Filter visible points — when pausing, contract right edge to `now`
// so new data (with real-time timestamps) can't appear past the live dot.
// While draining time debt (catch-up), also cap at `now` — data from the
// pause period has real-time timestamps ahead of the chart's lagging `now`,
// and letting those through would place points past the live tip, breaking
// the spline's monotone-X assumption and causing the line to loop backward.
const rawFilterRight = rightEdge - (rightEdge - now) * pauseProgress
const filterRight = timeDebtRef.current > 0.01 ? Math.min(now, rawFilterRight) : rawFilterRight
const visible: LivelinePoint[] = []
for (const p of effectivePoints) {
if (p.time >= leftEdge - 2 && p.time <= filterRight) {
Expand Down