Skip to content

fix(tps-chart): smooth Transaction volume line#99

Open
dak-agent[bot] wants to merge 4 commits into
mainfrom
smooth-transaction-volume-chart
Open

fix(tps-chart): smooth Transaction volume line#99
dak-agent[bot] wants to merge 4 commits into
mainfrom
smooth-transaction-volume-chart

Conversation

@dak-agent

@dak-agent dak-agent Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Switch the TPS <Area /> interpolation in the "Transaction volume" chart from type="linear" to type="monotone" so the line renders as a smooth curve instead of connected straight segments.

Single line change in frontend/components/network-activity-tracker/tps-chart.tsx.

Test plan

  • pnpm dev and confirm the Transaction volume chart on the dashboard renders a smoothed curve and tracks live TPS as before

@vercel

vercel Bot commented Jun 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
monode Ready Ready Preview, Comment Jun 9, 2026 6:16pm

Request Review

@greptile-apps

greptile-apps Bot commented Jun 8, 2026

Copy link
Copy Markdown

Greptile Summary

This PR significantly expands the TPS chart beyond its stated title, adding a sliding-window animation system (useSlidingNow, drawHistory, buildTicks) to make the chart continuously scroll and progressively draw each new data segment, in addition to disabling Recharts animation (isAnimationActive={false}). The lockfile and workspace config receive housekeeping fixes (duplicate entry removal, allowBuilds allowlisting).

  • Sliding window: useSlidingNow drives a rAF loop so domain={[windowStart, now]} updates every frame, keeping "now" pinned at the right edge as a smooth scroll.
  • Progressive draw: drawHistory replaces the latest history point with an interpolated "head" that travels from the previous point to the newest one over the inter-arrival interval, animating the growing line segment rather than snapping it into place.
  • Lockfile cleanup: Duplicate packages and snapshots entries are removed from pnpm-lock.yaml, and allowBuilds is added to pnpm-workspace.yaml for sharp and unrs-resolver.

Confidence Score: 4/5

Safe to merge for the animation improvements; the stated interpolation change (linear to monotone) noted in a prior review comment remains unimplemented.

The sliding-window and progressive-draw logic is well-structured and correctly guards edge cases (empty history, zero-duration intervals, progress clamping). The isAnimationActive={false} addition properly addresses the prior animation-loop concern. The one open gap is that Area type=linear was never updated to monotone despite the PR description describing that as the primary goal — flagged in a prior review comment and still present in the current file.

frontend/components/network-activity-tracker/tps-chart.tsx — the Area interpolation type prop

Important Files Changed

Filename Overview
frontend/components/network-activity-tracker/tps-chart.tsx Adds sliding-window animation via rAF-driven useSlidingNow, progressive segment drawing via drawHistory, and explicit time-axis config; isAnimationActive={false} addresses the previous animation-loop concern, but Area type=linear is unchanged despite the PR description stating it should become monotone
frontend/pnpm-lock.yaml Removes duplicate package/snapshot entries that were incorrectly doubled in the lockfile; no functional dependency changes
frontend/pnpm-workspace.yaml Adds allowBuilds for sharp and unrs-resolver, which legitimately require native compilation via postinstall scripts

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[subscribeToTps callback] -->|new TPS value + timestamp| B[useTps state - history array]
    C[requestAnimationFrame - useSlidingNow] -->|setNow 60fps| D[now - sliding timestamp]
    B --> E[TpsChart render]
    D --> E
    E --> F[drawHistory]
    F -->|less than 2 points| G[return history unchanged]
    F -->|compute progress 0 to 1| H[interpolated head vertex]
    H --> I[chartData - slice plus head]
    D --> J[windowStart - max 5min ago, min 3s ago]
    D --> K[buildTicks - anchor at now, step backwards]
    I --> L[AreaChart data equals chartData]
    J --> L
    K --> M[XAxis ticks and domain]
    M --> L
    L --> N[SVG - sliding window with animated leading edge]
Loading

Reviews (7): Last reviewed commit: "fix the x absis to have only 1 now" | Re-trigger Greptile

Comment thread frontend/components/network-activity-tracker/tps-chart.tsx Outdated
@socket-security

socket-security Bot commented Jun 9, 2026

Copy link
Copy Markdown

No dependency changes detected. Learn more about Socket for GitHub.

👍 No dependency changes detected in pull request

Camillebzd and others added 2 commits June 9, 2026 17:48
Switch the X axis to a continuous time scale whose right edge eases
toward the newest point's timestamp each animation frame. A freshly
appended point sits just past the edge (clipped by allowDataOverflow)
and is revealed sliding in from the right instead of snapping into a
discrete category slot; the animation halts once the edge catches up, so
the chart is still between points. isAnimationActive stays disabled to
avoid Recharts re-animation loops on every TPS event.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant