Skip to content

Fix NPM baseline tooltip label#966

Merged
tannerlinsley merged 1 commit into
mainfrom
taren/npm-baseline-tooltip-label
Jun 5, 2026
Merged

Fix NPM baseline tooltip label#966
tannerlinsley merged 1 commit into
mainfrom
taren/npm-baseline-tooltip-label

Conversation

@tannerlinsley
Copy link
Copy Markdown
Member

@tannerlinsley tannerlinsley commented Jun 5, 2026

What changed

  • Added a persisted baseline display label for preset baselines.
  • Updated the NPM stats chart tooltip to show the preset label or a comma-separated package list instead of the internal baseline marker.
  • Kept the baseline series key internal so the chart still treats the baseline line as its own series.

Validation

  • pnpm test

Summary by CodeRabbit

  • Improvements
    • Baseline comparison labels now derive from preset titles for clearer display in charts and sections.
    • Enhanced baseline series identification and color handling in npm stats charts for improved visual clarity.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 5, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 571e26bf-5e76-43f0-a3e9-6ac3a3a2654e

📥 Commits

Reviewing files that changed from the base of the PR and between f09264b and a49e0ec.

📒 Files selected for processing (6)
  • src/components/npm-stats/BaselineSection.tsx
  • src/components/npm-stats/NPMStatsChart.tsx
  • src/components/npm-stats/shared.ts
  • src/routes/$libraryId/$version.docs.npm-stats.tsx
  • src/routes/stats/npm/-comparisons.ts
  • src/routes/stats/npm/index.tsx

📝 Walkthrough

Walkthrough

The PR adds custom baseline display labels to npm stats visualizations. A new baselineLabel field is introduced to baseline package groups (with schema updates), a getBaselineDisplayName utility computes readable baseline names, and route handlers populate this field from preset titles. BaselineSection and NPMStatsChart use the new utility and series identifier to render baselines consistently.

Changes

Baseline Display Label in NPM Stats

Layer / File(s) Summary
Schema and baseline display utility
src/routes/stats/npm/-comparisons.ts, src/components/npm-stats/shared.ts
packageGroupSchema adds optional baselineLabel field. New getBaselineDisplayName utility derives a human-readable baseline label from package groups by collecting group baseline labels (trimmed) or joining package names, with deduplication and fallback to 'Baseline'.
Baseline chip display
src/components/npm-stats/BaselineSection.tsx
BaselineSection imports getBaselineDisplayName and uses it to compute and render the baseline chip text, replacing the prior manual name-joining logic.
Chart series rendering with baseline identifier
src/components/npm-stats/NPMStatsChart.tsx
NPMStatsChart introduces BASELINE_LINE_SERIES constant for baseline series identification, augments plot data with seriesName fields to distinguish series, adds getStrokeColor function to apply appropriate stroke colors based on series type, defines lineOptions with z: 'seriesName' for Plot configuration, and updates color scale logic to compare against the computed baselineLineName.
Route data population from presets
src/routes/stats/npm/index.tsx, src/routes/$libraryId/$version.docs.npm-stats.tsx
Route search typings add optional baselineLabel field. Preset application handlers populate baselineLabel on newly created baseline package groups using preset.title.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A baseline, once nameless and bare,
Now wears a label with elegant care—
From preset to chart, the titles align,
Display names flow in a harmonious line.
One series identifier to rule them all,
The stats charts respond to this purposeful call! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the primary change: fixing the NPM baseline tooltip label by introducing a display label mechanism for baselines.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch taren/npm-baseline-tooltip-label

Comment @coderabbitai help to get the list of available commands and usage tips.

@tannerlinsley tannerlinsley merged commit 209b735 into main Jun 5, 2026
9 checks passed
@tannerlinsley tannerlinsley deleted the taren/npm-baseline-tooltip-label branch June 5, 2026 18:39
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