Repository navigation
isDevAppがfalseの場合に路線推定を無効化 - #5757
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
📝 WalkthroughWalkthrough
Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/hooks/useRouteEstimation.ts`:
- Around line 337-341: useRouteEstimationControlNoop
が毎レンダーで新しいオブジェクト/関数参照を返しており、startEstimation と stopEstimation が
useTrainTypeMismatchDetector の依存配列を不必要に更新しています。対処として
useRouteEstimationControlNoop 内で返すオブジェクトを useMemo でメモ化し、startEstimation と
stopEstimation を useCallback(または同等の安定化手法)で固定して参照安定化してください; これにより
useTrainTypeMismatchDetector の依存配列に安全に含められるようになります(参照する識別子:
useRouteEstimationControlNoop, startEstimation, stopEstimation,
useTrainTypeMismatchDetector)。
- Around line 288-299: The noop hook currently creates a new object and
functions on every call (useRouteEstimationNoop), causing unstable references
(e.g., reset used in useTrainTypeMismatchDetector) and unwanted effect re-runs;
fix by defining a single module-level constant (e.g., NOOP_ESTIMATION_RESULT)
that contains frozen/stable no-op functions for selectCandidate and reset and
the bufferInfo payload, and return that constant from useRouteEstimationNoop so
the reference is stable across renders.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a32ae98b-9a45-4b23-824b-3762a320a389
📒 Files selected for processing (1)
src/hooks/useRouteEstimation.ts
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/hooks/useRouteEstimation.test.tsx (1)
25-27: LGTM! テスト環境で Impl 実装を強制する適切なモック
isDevApp: trueを強制することで、テストが実際のロジックを持つ*Implバリアントを実行するようになっています。💡 オプション: noop 実装のテスト追加
本番ビルドでの挙動を検証するために、
isDevApp: falseのケースをテストする別のテストファイルまたはテストブロックを追加することを検討できます。ただし、noop 実装は単に定数を返すだけなので、優先度は低いです。// 例: 別のdescribeブロックで isDevApp: false をテスト // jest.doMock を使用してモジュールを再読み込みする必要があります🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/hooks/useRouteEstimation.test.tsx` around lines 25 - 27, Add a new test block that verifies the noop (production) variant by mocking isDevApp as false using jest.doMock and re-importing the hook, e.g., set isDevApp: false, require the module that exports useRouteEstimation, and assert the noop behavior (the constant return values) of useRouteEstimation; ensure you restore or clear the mock afterwards so the existing tests that rely on isDevApp: true remain unaffected.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/hooks/useRouteEstimation.test.tsx`:
- Around line 25-27: Add a new test block that verifies the noop (production)
variant by mocking isDevApp as false using jest.doMock and re-importing the
hook, e.g., set isDevApp: false, require the module that exports
useRouteEstimation, and assert the noop behavior (the constant return values) of
useRouteEstimation; ensure you restore or clear the mock afterwards so the
existing tests that rely on isDevApp: true remain unaffected.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4779ce1e-9a4d-4213-b899-97ca3b026b2a
📒 Files selected for processing (2)
src/hooks/useRouteEstimation.test.tsxsrc/hooks/useRouteEstimation.ts
Summary
useRouteEstimationとuseRouteEstimationControlを、isDevAppがfalseの場合にnoop実装に切り替えるようにガードTest plan
npm run typecheckが通ること🤖 Generated with Claude Code
Summary by CodeRabbit