Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Renderer treats a sub-pixel width difference as a resize, which cancels the `motion()` entrance

クローズ 初心者向け
#182 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
85/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
react, typescript
領域
frontend

調査の方向性

チャートレンダラーのコード内の responsiveSizeChanged 関数を探します。ここでは厳密等価チェック next.width !== scene.width (および高さの同等チェック)がサブピクセルの差異を誤ってリサイズとして検知しています。両方の比較を0.5px未満の差異を無視するように更新します。例えば Math.abs(next.width - scene.width) >= 0.5 を使用します。修正をテストするには、分数ピクセル幅のコンテナ内で renderer={motion()} を指定した Chart をレンダリングし、不要なリサイズレンダリングによってキャンセルされることなくエントランスアニメーションが完了することを確認します。

索引モデルが issue の本文から書いたものです。

説明

Version: @tanstack/charts 1.0.0 (unchanged on main).

The first render sizes the scene from getComputedStyle(container).width (contentBoxDimension → cssPixelValue). Chromium serializes that rounded, e.g. 569.594px. The ResizeObserver then reports the exact contentRect.width, 569.59375, and responsiveSizeChanged compares the two with !==:

next.width !== scene.width

So on any container with a fractional width (a 32% grid column, minmax(…)), the observer's first callback schedules a "resize" render. With motion()'s default resize: false, that render paints the final frame without animation, and the entrance is cancelled one frame after it starts. Containers that happen to be a whole number of pixels wide animate fine, so it looks random from the app side.

Repro: mount a Chart with renderer={motion()} inside <div style="width: 569.59375px">. data-ts-motion-state goes running, and the SVG is replaced on the first observer callback without ever reaching finished.

Suggested fix: treat a difference under half a pixel as no change (Math.abs(next.width - scene.width) >= 0.5, same for height), or take the first measurement from a source with the same precision as the observer. We're running the first as a pnpm patch, and it restores the entrance.

主要言語
TypeScript
スター
842
フォーク
53
平均マージ
4時間 40分
マージ済み PR(30日)
16

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TanStack/charts のほかの issue

TanStack/charts の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。