Repository navigation
パフォーマンス改善: 不要な再レンダーと冗長な通信を削減 - #6151
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough複数の LineBoard コンポーネントとその依存層全体で Jotai セレクタを導入し、 ChangesJotai セレクタ導入と点滅制御の統一化
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/store/selectors/station.test.ts (1)
5-37: ⚡ Quick win
stationsAtomのテストカバレッジを追加することを推奨
arrivedAtomとapproachingAtomは十分にテストされていますが、stationsAtomのテストケースがありません。実装パターンは同じですが、明示的なテストがあると保守性が向上します。📝 提案: stationsAtom のテストケース追加
it('stationStateのフィールド値を導出する', () => { const store = createStore(); store.set(stationState, { ...store.get(stationState), arrived: true, approaching: false, + stations: [{ id: 1, name: 'Test Station' }], }); expect(store.get(arrivedAtom)).toBe(true); expect(store.get(approachingAtom)).toBe(false); + expect(store.get(stationsAtom)).toEqual([{ id: 1, name: 'Test Station' }]); });🤖 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/store/selectors/station.test.ts` around lines 5 - 37, Add tests for stationsAtom similar to the existing arrivedAtom/approachingAtom specs: create a store via createStore(), set stationState to change the fields that stationsAtom derives from, assert store.get(stationsAtom) reflects the expected derived value, and add a subscriber via store.sub(stationsAtom, listener) to assert it is only notified when the relevant stationState fields for stationsAtom actually change; use the same pattern as the two existing tests (createStore, store.set(stationState, ...), expect(store.get(...)) and expect(listener) assertions) and clean up with unsub().
🤖 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.
Nitpick comments:
In `@src/store/selectors/station.test.ts`:
- Around line 5-37: Add tests for stationsAtom similar to the existing
arrivedAtom/approachingAtom specs: create a store via createStore(), set
stationState to change the fields that stationsAtom derives from, assert
store.get(stationsAtom) reflects the expected derived value, and add a
subscriber via store.sub(stationsAtom, listener) to assert it is only notified
when the relevant stationState fields for stationsAtom actually change; use the
same pattern as the two existing tests (createStore, store.set(stationState,
...), expect(store.get(...)) and expect(listener) assertions) and clean up with
unsub().
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f7ffdd1b-b30e-4693-8df5-9d2d0b3162f5
📒 Files selected for processing (33)
src/components/LineBoard.test.tsxsrc/components/LineBoard.tsxsrc/components/LineBoard/shared/components/BlinkingChevron.test.tsxsrc/components/LineBoard/shared/components/BlinkingChevron.tsxsrc/components/LineBoard/shared/components/index.tssrc/components/LineBoardE231.tsxsrc/components/LineBoardEast.test.tsxsrc/components/LineBoardEast.tsxsrc/components/LineBoardJO.test.tsxsrc/components/LineBoardJO.tsxsrc/components/LineBoardJRKyushu.test.tsxsrc/components/LineBoardJRKyushu.tsxsrc/components/LineBoardSaikyo.test.tsxsrc/components/LineBoardSaikyo.tsxsrc/components/LineBoardToei.test.tsxsrc/components/LineBoardToei.tsxsrc/components/LineBoardWest.test.tsxsrc/components/LineBoardWest.tsxsrc/components/LineBoardYamanotePad.test.tsxsrc/components/LineBoardYamanotePad.tsxsrc/components/PadArch.tsxsrc/hooks/useAppleWatch.tssrc/hooks/useBadAccuracy.tssrc/hooks/useRefreshStation.tssrc/lib/remoteConfig.test.tssrc/lib/remoteConfig.tssrc/screens/Main.tsxsrc/store/selectors/location.test.tssrc/store/selectors/location.tssrc/store/selectors/navigation.test.tssrc/store/selectors/navigation.tssrc/store/selectors/station.test.tssrc/store/selectors/station.ts
概要
devブランチのパフォーマンス監査で検出した、不要な再レンダー・再マウント・冗長なブリッジ/ネットワーク通信を解消するパフォーマンス改善です。アプリの表示・挙動は変更しません。
変更の種類
変更内容
BlinkingChevronコンポーネントへ分離し、East/Toei/Saikyo/JRKyushu の4テーマで毎秒8セル全体が再レンダーされていた問題を解消(StationNameCellをReact.memo化)LineBoardのuseCallbackコンポーネント(<Inner />)をuseMemo要素化し、依存変化のたびにボードのサブツリー全体がアンマウント→再マウントされていた問題を修正(山手線iPadテーマでアニメーションが何度も走る既知症状の原因)src/store/selectors/にフィールド単位の派生atom(arrivedAtom/approachingAtom/stationsAtom/leftStationsAtom/enabledLanguagesAtom/locationAccuracyAtom)を新設し、LineBoard系9コンポーネントとuseBadAccuracyのモノリシックatom全体購読を解消(ヘッダー言語ローテーションやGPS座標更新による無関係な再レンダーを防止)useRefreshStationで値が変わらない場合のatom書き込みを抑制し、全購読者への不要な再レンダー通知を防止Promise.allで並列化getMaxPermitAccuracy等)にモジュール内キャッシュを追加し、GPS更新ごとのSDK問い合わせを削減PadArchの区間クリップスタイル・darken()・駅ごとのドット/ラベルスタイルをuseMemoで事前計算テスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ることnpm run lint && npm test && npm run typecheckをローカルで実行し全て通過(170スイート / 1807テスト)。新規テストとしてBlinkingChevron(点滅順序)、各selector(値導出と無関係フィールド変更時の通知抑制)、Remote Configキャッシュ(キャッシュ/無効化挙動)を追加。実機でのUI確認(4テーマのチェブロン点滅・山手線iPadテーマの到着アニメーション)は未実施のため、マージ前の確認を推奨します。
関連Issue
スクリーンショット(任意)
https://claude.ai/code/session_01B1nvgXQqduJFBSmP9ZGKRB
Generated by Claude Code
Summary by CodeRabbit
新機能
バグ修正
改善
テスト