Skip to content

練馬春日町の駅名表示欠けを修正 - #6084

Merged
TinyKitten merged 1 commit into
devfrom
fix/nerima-kasugacho-header
May 29, 2026
Merged

TinyKitten merged 1 commit into
devfrom
fix/nerima-kasugacho-header

Conversation

@TinyKitten

@TinyKitten TinyKitten commented May 29, 2026 •

Copy link
Copy Markdown
Member

概要

駅名表示の幅測定結果が駅名変更後も再利用され、「練馬春日町」の末尾が欠けて表示される場合がある不具合を修正しました。

変更の種類

  • バグ修正
  • 新機能
  • リファクタリング
  • ドキュメント
  • CI/CD
  • その他

変更内容

  • HeaderStationName で測定した文字幅を対象テキストと紐づけて保持するようにしました。
  • 現在の駅名と測定済みテキストが一致しない場合は古い測定幅を使わず、再測定まで十分な幅で描画するようにしました。
  • 「練馬春日」から「練馬春日町」へ表示が変わる場合に、前回の短い幅で末尾がクリップされないことを確認する回帰テストを追加しました。

テスト

  • npm run lint が通ること
  • npm test が通ること
  • npm run typecheck が通ること

実行したコマンド:

npx biome check src/components/HeaderStationName.tsx src/components/HeaderStationName.test.tsx
set TZ=UTC&& node_modules\.bin\jest.cmd HeaderStationName.test.tsx --runInBand

補足: Windows cmd では package script 内の TZ=UTC が解釈されないため、対象 Jest は TZ を設定して直接実行しました。

関連Issue

なし

スクリーンショット(任意)

UI描画ロジックの修正ですが、スクリーンショットは未取得です。

Summary by CodeRabbit

  • Bug Fixes

    • 駅名が変更される際に文字幅の計測が正しくリセットされるよう改善しました。
  • Tests

    • 駅名変更時の文字幅計測動作を検証するテストケースを追加しました。

Review Change Stack

@TinyKitten TinyKitten self-assigned this May 29, 2026
@coderabbitai

coderabbitai Bot commented May 29, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 24174516-5486-4fcb-842b-d0856cdb651b

📥 Commits

Reviewing files that changed from the base of the PR and between 4fe3749 and a63fad7.

📒 Files selected for processing (2)
  • src/components/HeaderStationName.test.tsx
  • src/components/HeaderStationName.tsx

📝 Walkthrough

Walkthrough

HeaderStationName コンポーネントの文字幅計測キャッシュが、テキスト変更時に無効化されない問題を修正しました。状態構造を単一の幅値から「テキストと幅のペア」に変更し、前回測定したテキストと現在のテキストが一致する場合のみキャッシュを採用するロジックに改善しました。

Changes

HeaderStationName の計測状態管理修正

Layer / File(s) Summary
計測状態の構造と再計測ロジック
src/components/HeaderStationName.tsx
textWidth 状態を、測定対象の text と幅を保持する measuredText オブジェクトに変更。onTextLayout と onLayout ハンドラーで measuredText を更新し、現在のテキストと一致する場合のみ計測済みの幅を使用。幅フォールバック値を '100%' から MEASURE_TEXT_WIDTH に調整。
テキスト変更時の再計測検証テスト
src/components/HeaderStationName.test.tsx
駅名変更後のリレンダーで前回の計測結果を再利用せず、変更後の駅名に対して wrapper 幅と transform スケールが正しくリセットされることを検証するテストケースを追加。

Possibly related PRs

  • TrainLCD/MobileApp#6057: HeaderStationName の計測結果キャッシュをテキスト変更時にリセットするための measuredText の一致判定に関する同一コンポーネントの計測リセット方針を共有しています。
  • TrainLCD/MobileApp#6066: HeaderStationName.tsx の計測状態管理(textWidth → measuredText への変更、フォールバック幅調整)と同じコード領域の実装・テスト変更を扱っています。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

駅名が変わる度に 🚃
キャッシュは新しく測られる
テキストと幅のペアで
前回の値に頼らず
正しい大きさで表示される🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed タイトルは変更内容の主要なポイント(練馬春日町の駅名表示欠けの修正)を簡潔に表現しており、チェンジセット全体と一致している。
Description check ✅ Passed PR説明がテンプレートのすべての必須セクション(概要、変更の種類、変更内容、テスト)を埋めており、十分に完成している。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 fix/nerima-kasugacho-header

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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

@github-actions github-actions Bot added the react label May 29, 2026
@TinyKitten
TinyKitten marked this pull request as ready for review May 29, 2026 15:42
@TinyKitten
TinyKitten merged commit 6c76479 into dev May 29, 2026
6 checks passed
@TinyKitten
TinyKitten deleted the fix/nerima-kasugacho-header branch May 29, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant