fix: accept configured scales for union axes - #51
Conversation
📝 WalkthroughWalkthroughThe change distributes ChangesConfigured scale support
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/charts-core/docs/comparison.md`:
- Around line 15-22: Regenerate the comparison documentation from its source in
the root docs/ tree rather than editing the generated packages/charts-core/docs
copy. Apply the intended changes to the root comparison document, then run pnpm
docs:sync so the generated copy stays synchronized.
In `@packages/charts-core/src/scale-input.ts`:
- Around line 50-52: The isScaleFactory type guard currently loses the caller’s
value type by using Function and a fixed ChartValue predicate. Make
isScaleFactory generic over TValue and return source is
ChartScaleFactory<TValue>, then propagate TValue through
resolveScaleInput<TValue> and its call sites so scale factory inference remains
narrowed; alternatively remove this guard from that path.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: e7462759-5c45-4f55-aded-658face3c08e
📒 Files selected for processing (9)
.changeset/calm-scales-agree.mdAPI-FRICTION.mdbenchmarks/bundle-size/universal-baseline.jsonbenchmarks/comparison/bundle-baseline.jsondocs/comparison.mdpackages/charts-core/docs/comparison.mdpackages/charts-core/src/scale-input.tspackages/charts-core/src/type-contract.test.tspackages/charts-core/src/types.ts
| | [TanStack Charts](./overview.md) | `@tanstack/charts` | workspace `3fdff48` | | ||
| | [Chart.js](https://www.chartjs.org/docs/latest/) | `chart.js` | npm `4.5.1` | | ||
| | [Apache ECharts](https://echarts.apache.org/handbook/en/best-practices/canvas-vs-svg/) | `echarts` | npm `6.1.0` | | ||
| | [Recharts](https://recharts.github.io/en-US/) | `recharts` | npm `3.10.1` | | ||
| | [Observable Plot](https://observablehq.com/plot/features/plots) | `@observablehq/plot` | npm `0.6.17` | | ||
|
|
||
| The competitor versions are exact package pins, not latest versions inferred | ||
| at page render time. The measured TanStack workspace revision is `e4b5249`. | ||
| at page render time. The measured TanStack workspace revision is `3fdff48`. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Regenerate this file instead of editing it directly.
Make these changes in docs/comparison.md, then run pnpm docs:sync. Direct edits to this generated copy can be overwritten and can cause source/copy drift.
As per coding guidelines, public documentation must be authored in the root docs/ tree; do not directly edit packages/charts-core/docs because those copies are generated by pnpm docs:sync.
Also applies to: 93-93
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/charts-core/docs/comparison.md` around lines 15 - 22, Regenerate the
comparison documentation from its source in the root docs/ tree rather than
editing the generated packages/charts-core/docs copy. Apply the intended changes
to the root comparison document, then run pnpm docs:sync so the generated copy
stays synchronized.
Source: Coding guidelines
| export function isScaleFactory( | ||
| source: Function, | ||
| ): source is ChartScaleFactory<ChartValue> { |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -nP '\bisScaleFactory\b' --glob '*.ts' --glob '*.tsx' .
rg -n 'scale-input|isScaleFactory' --glob 'package.json' --glob '*.ts' --glob '*.tsx' .Repository: TanStack/charts
Length of output: 1243
Preserve isScaleFactory as a generic type guard.
isScaleFactory remains linked to resolveScaleInput<TValue> narrowing, but the current Function parameter and non-generic predicate can break type narrowing for scale factory inference. Use source is ChartScaleFactory<TValue>, with TValue propagated through the caller path, or remove the guard from this path.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/charts-core/src/scale-input.ts` around lines 50 - 52, The
isScaleFactory type guard currently loses the caller’s value type by using
Function and a fixed ChartValue predicate. Make isScaleFactory generic over
TValue and return source is ChartScaleFactory<TValue>, then propagate TValue
through resolveScaleInput<TValue> and its call sites so scale factory inference
remains narrowed; alternatively remove this guard from that path.
Summary
Validation
pnpm validatepnpm benchmark:checkCloses #34
Summary by CodeRabbit
New Features
string | Date.Documentation
Chores