Skip to content

Finalize Charts 0.0.1 site contracts - #1083

Merged
tannerlinsley merged 2 commits into
mainfrom
taren/charts-0.0.1-site-cleanup
Jul 31, 2026
Merged

Finalize Charts 0.0.1 site contracts#1083
tannerlinsley merged 2 commits into
mainfrom
taren/charts-0.0.1-site-cleanup

Conversation

@tannerlinsley

@tannerlinsley tannerlinsley commented Jul 31, 2026

Copy link
Copy Markdown
Member

Summary

  • announce the public TanStack Charts 0.0.1 release on the Charts landing page
  • pin the site to @tanstack/charts and @tanstack/react-charts 0.0.1
  • migrate all production chart consumers to definition-owned data and behavior
  • require the deployed schema-v4 catalog and remove the temporary schema-v2 fallback

Verification

  • pnpm test: 135 tests, 134 passed, 1 intentional skip
  • TypeScript and type-aware lint clean
  • Cloudflare production build clean
  • public schema-v4 catalog already verified at the Charts release revision

Summary by CodeRabbit

  • New Features

    • TanStack Charts 0.0.1 is now available through npm.
    • Added installation guidance for vanilla TypeScript and framework adapters.
    • Enhanced time series, dependency graph, sparkline, and npm statistics charts with integrated tooltips, animations, and smoother updates.
  • Bug Fixes

    • Improved chart catalog validation, asset-size checks, source integrity, and preload ordering.
    • Retired support for outdated catalog formats in favor of the current format.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Chart components now create complete, memoized definitions, and the catalog accepts only schema version 4 with unified validation. Charts packages and landing-page installation guidance are updated for version 0.0.1.

Chart definition migration

Layer / File(s) Summary
Chart definition factories
src/components/charts/TimeSeriesChart.tsx, src/components/intent/SkillDependencyGraph.tsx, src/components/intent/SkillSparkline.tsx, src/components/npm-stats/NPMStatsChart.tsx
Chart configuration is assembled in local factories, including animation, tooltip, focus, and keyboard settings.
Memoized chart wiring
src/components/charts/TimeSeriesChart.tsx, src/components/intent/SkillDependencyGraph.tsx, src/components/intent/SkillSparkline.tsx, src/components/npm-stats/NPMStatsChart.tsx
Components memoize complete definitions and pass them through Chart’s definition prop.
Charts package release messaging
package.json, src/components/landing/ChartsLanding.tsx
Chart packages are updated to version 0.0.1, and installation guidance is added to the landing page.

Catalog schema version 4

Layer / File(s) Summary
Schema and validation rules
src/utils/charts-catalog.ts
Manifest parsing now accepts only schema version 4 and always applies dataset, authored-source, asset-size, and canonical preload validation.
Compatibility fixture and test removal
tests/charts-catalog-manifest.test.ts, tests/charts-catalog-source.test.ts, tests/charts-catalog-test-fixture.ts
Version 2 acceptance and source-loading coverage is removed, while rejection and version 4 validation coverage remains.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested reviewers: abeuty

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 clearly and concisely summarizes the PR’s main goal of finalizing the Charts 0.0.1 release and site contracts.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch taren/charts-0.0.1-site-cleanup

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.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 31, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
tanstack-com 2cc56da Commit Preview URL

Branch Preview URL
Jul 31 2026, 12:45 AM

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@src/components/npm-stats/NPMStatsChart.tsx`:
- Line 2451: Stabilize the input used by the ChartFigure definition: update the
input construction and createNpmStatsChart useMemo in NPMStatsChart so parent
renders do not rebuild the definition solely because of object identity. Memoize
the input or use semantic dependencies, while preserving updates for actual
chart-data and timeline-range changes.
🪄 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: ce8c413f-9157-4a88-9ccd-cace51d79dd1

📥 Commits

Reviewing files that changed from the base of the PR and between c09e354 and dc6fa00.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (11)
  • package.json
  • src/components/charts/TimeSeriesChart.tsx
  • src/components/intent/SkillDependencyGraph.tsx
  • src/components/intent/SkillSparkline.tsx
  • src/components/landing/ChartsLanding.tsx
  • src/components/npm-stats/NPMStatsChart.tsx
  • src/utils/charts-catalog.server.ts
  • src/utils/charts-catalog.ts
  • tests/charts-catalog-manifest.test.ts
  • tests/charts-catalog-source.test.ts
  • tests/charts-catalog-test-fixture.ts
💤 Files with no reviewable changes (3)
  • tests/charts-catalog-source.test.ts
  • src/utils/charts-catalog.server.ts
  • tests/charts-catalog-test-fixture.ts

Comment thread src/components/npm-stats/NPMStatsChart.tsx Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@src/components/npm-stats/NPMStatsChart.tsx`:
- Around line 2445-2449: Update useNpmStatsChartDefinition to avoid assigning a
revisioned chart definition to cached.current during ChartFigure render. Derive
or memoize createNpmStatsChart(input) using input and revision as dependencies,
preserving recalculation when either changes without render-phase ref mutation.
🪄 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: 3439462c-3a4f-46a7-b354-76971451b3f2

📥 Commits

Reviewing files that changed from the base of the PR and between dc6fa00 and 2cc56da.

📒 Files selected for processing (1)
  • src/components/npm-stats/NPMStatsChart.tsx

Comment on lines +2445 to +2449
if (!cached.current || cached.current.revision !== revision) {
cached.current = {
definition: createNpmStatsChart(input),
revision,
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Inspect all render-time accesses to the definition cache before replacing it.
rg -n -C8 'useNpmStatsChartDefinition|cached\.current|createNpmStatsChart\(' \
  src/components/npm-stats/NPMStatsChart.tsx

Repository: TanStack/tanstack.com

Length of output: 2088


🏁 Script executed:

#!/bin/bash
# Inspect the hook callers and any render-pure memoization in the component tree.
set -euo pipefail

printf '--- usages of useNpmStatsChartDefinition ---\n'
rg -n -C6 'useNpmStatsChartDefinition\(' . || true

printf '\n--- definition revision types/usages ---\n'
rg -n -C4 'NpmStatsChartDefinitionRevision|definitionRevision' src package.json || true

printf '\n--- chart creation memoization/cache refs near NPMStatsChart.tsx ---\n'
rg -n -C3 'useMemo|cached\s*=|React\s*\.\s*useMemo|defineChart\(' src/components/npm-stats/NPMStatsChart.tsx || true

Repository: TanStack/tanstack.com

Length of output: 250


🌐 Web query:

React useRef render phase mutations refs should be initialized only during render except one-time initialization

💡 Result:

In React, the general rule is to avoid reading or writing ref.current during the render phase [1][2]. Rendering must be a pure process [3], and because React may call components multiple times or in ways that are non-deterministic during concurrent rendering, side effects during render can lead to unpredictable behavior and bugs [4]. The explicit exception to this rule is one-time lazy initialization [1][2]. You may initialize a ref during the render phase if you follow this specific, idempotent pattern: function MyComponent { const ref = useRef(null); if (ref.current === null) { ref.current = new ExpensiveObject; } return null; } This is permitted because the operation is idempotent—it produces the same result regardless of how many times the check is performed, and it only modifies the ref when it is truly empty [2][4]. Key principles to remember: - Why refs are usually restricted: Unlike state, ref mutations do not trigger re-renders, and reading them during render can cause consistency issues or "tearing" if the component render is interrupted and resumed by React [1][4]. - Purity requirements: Even when using the lazy initialization pattern, the value being assigned must be created in a way that respects React's requirement for purity (e.g., avoiding impure functions like Date.now during render) [5]. - Best practice: If you need to store data that affects the component's output, use state instead [1]. If you need to perform side effects (like API calls or DOM manipulations) using a ref, those should be placed inside useEffect or useLayoutEffect [6][3].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "--- usages of useNpmStatsChartDefinition ---"
rg -n -C6 'useNpmStatsChartDefinition\(' . || true

echo
echo "--- definition revision types/usages ---"
rg -n -C4 'NpmStatsChartDefinitionRevision|definitionRevision' src package.json || true

echo
echo "--- chart creation memoization/cache refs near NPMStatsChart.tsx ---"
rg -n -C3 'useMemo|cached\s*=|React\s*\.\s*useMemo|defineChart\(' src/components/npm-stats/NPMStatsChart.tsx || true

echo
echo "--- createNpmStatsChart and hook implementation context ---"
sed -n '2180,2505p' src/components/npm-stats/NPMStatsChart.tsx

Repository: TanStack/tanstack.com

Length of output: 16798


Keep the chart definition cache render-pure.

useNpmStatsChartDefinition writes cached.current whenever the revision changes during ChartFigure render, which is not the allowed one-time ref.current === null initialization. Create the definition through render-pure memoization/data derivation keyed by input and revision instead of storing the revisioned definition in a ref during render.

Relevant lines
if (!cached.current || cached.current.revision !== revision) {
  cached.current = {
    definition: createNpmStatsChart(input),
    revision,
  }
}
🧰 Tools
🪛 React Doctor (0.9.1)

[error] 2446-2446: This ref is mutated during render. React can replay or discard render work, so the mutation can leak from UI that never commits.

Move ref writes into an event handler or effect. Render must stay pure because React can replay or discard it. The predictable null-guarded lazy initialization pattern remains supported.

(no-ref-current-in-render)

🤖 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 `@src/components/npm-stats/NPMStatsChart.tsx` around lines 2445 - 2449, Update
useNpmStatsChartDefinition to avoid assigning a revisioned chart definition to
cached.current during ChartFigure render. Derive or memoize
createNpmStatsChart(input) using input and revision as dependencies, preserving
recalculation when either changes without render-phase ref mutation.

Source: Linters/SAST tools

@tannerlinsley
tannerlinsley merged commit c4687bf into main Jul 31, 2026
7 checks passed
@tannerlinsley
tannerlinsley deleted the taren/charts-0.0.1-site-cleanup branch July 31, 2026 00:47
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