Skip to content

fix: update activeLabel type to be a string | number#6691

Merged
ckifer merged 1 commit intomainfrom
fix/activeLabelType
Nov 26, 2025
Merged

fix: update activeLabel type to be a string | number#6691
ckifer merged 1 commit intomainfrom
fix/activeLabelType

Conversation

@ckifer
Copy link
Member

@ckifer ckifer commented Nov 25, 2025

Description

Not really sure if this is the right thing to do, technically a breaking change in types but also the previous typage was wrong so this is a bug fix

Related Issue

#6688

Motivation and Context

#6688

How Has This Been Tested?

  • types are updated

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • I have added a storybook story or VR test, or extended an existing story or VR test to show my changes

Summary by CodeRabbit

  • Refactor
    • Introduced a unified ActiveLabel type to standardize tooltip label handling across the codebase.
    • Updated tooltip-related APIs and synchronization paths to use the new type for consistent type safety and clearer interfaces.
    • No functional or UI behavior changes expected; this is a type/consistency improvement.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 25, 2025

Walkthrough

Introduces a new ActiveLabel type (string | number | undefined) in synchronization types and replaces inline label types across hooks, selectors, combiners, and synchronization utilities to use ActiveLabel; no runtime behavior changes.

Changes

Cohort / File(s) Summary
Type Definition
src/synchronisation/types.ts
Adds `ActiveLabel = string
Hooks
src/hooks.ts
Imports ActiveLabel; updates useActiveTooltipLabel return type from `string
Selectors / Combiners
src/state/selectors/combiners/combineActiveLabel.ts, src/state/selectors/combiners/combineTooltipPayload.ts, src/state/selectors/tooltipSelectors.ts
Import ActiveLabel; change combineActiveLabel return type, combineTooltipPayload activeLabel parameter type, and selectActiveLabel return type to ActiveLabel.
Synchronization
src/synchronisation/useChartSynchronisation.tsx
Imports ActiveLabel; updates useTooltipChartSynchronisation activeLabel parameter type to ActiveLabel.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Pattern: homogeneous, type-alias substitution across a small set of files.
  • Likely low-risk, but review these files closely:
    • src/synchronisation/types.ts — verify exported type and JSDoc.
    • src/state/selectors/combiners/combineActiveLabel.ts — confirm return undefined handling remains correct.
    • src/hooks.ts and src/synchronisation/useChartSynchronisation.tsx — ensure import paths and signatures align with downstream consumers.

Suggested reviewers

  • PavelVanecek

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: updating the activeLabel type to include string | number instead of just string | undefined.
Description check ✅ Passed The description addresses most template sections with relevant content, including motivation (issue #6688), type change classification, and testing notes, though testing details are minimal.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/activeLabelType

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ca8b8f6 and 0bb951f.

📒 Files selected for processing (6)
  • src/hooks.ts (2 hunks)
  • src/state/selectors/combiners/combineActiveLabel.ts (1 hunks)
  • src/state/selectors/combiners/combineTooltipPayload.ts (2 hunks)
  • src/state/selectors/tooltipSelectors.ts (2 hunks)
  • src/synchronisation/types.ts (2 hunks)
  • src/synchronisation/useChartSynchronisation.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
  • src/synchronisation/types.ts
  • src/state/selectors/tooltipSelectors.ts
  • src/state/selectors/combiners/combineTooltipPayload.ts
  • src/hooks.ts
  • src/synchronisation/useChartSynchronisation.tsx
  • src/state/selectors/combiners/combineActiveLabel.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build, Test, Pack
  • GitHub Check: Analyze (javascript-typescript)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.02%. Comparing base (599a9b7) to head (0bb951f).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6691      +/-   ##
==========================================
- Coverage   94.02%   94.02%   -0.01%     
==========================================
  Files         499      499              
  Lines       42547    42544       -3     
  Branches     4873     4873              
==========================================
- Hits        40004    40001       -3     
  Misses       2538     2538              
  Partials        5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ckifer ckifer requested a review from PavelVanecek November 25, 2025 03:24
activeIndex: number | TooltipIndex | undefined;
activeLabel: string | undefined;
/**
* The X value (label) of the active tooltip entry.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it X in vertical charts? And what is it in polar charts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is the categorical domain value in categorical charts. In numeric and polar charts it is the domain.

@codecov
Copy link

codecov bot commented Nov 25, 2025

Bundle Report

Changes will decrease total bundle size by 14 bytes (-0.0%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
recharts/bundle-cjs 1.14MB -7 bytes (-0.0%) ⬇️
recharts/bundle-es6 987.71kB -7 bytes (-0.0%) ⬇️

Affected Assets, Files, and Routes:

view changes for bundle: recharts/bundle-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
hooks.js -7 bytes 5.64kB -0.12%
view changes for bundle: recharts/bundle-es6

Assets Changed:

Asset Name Size Change Total Size Change (%)
hooks.js -7 bytes 4.8kB -0.15%

@ckifer ckifer force-pushed the fix/activeLabelType branch from ca8b8f6 to 0bb951f Compare November 26, 2025 01:00
@ckifer ckifer merged commit df81b8a into main Nov 26, 2025
27 of 29 checks passed
@ckifer ckifer deleted the fix/activeLabelType branch November 26, 2025 17:12
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.

2 participants