Repository navigation
オートモードが通過駅を迂回するバグを修正&オートモードv1の完全廃止 - #5274
Conversation
📝 WalkthroughWalkthroughレガシー自動モードフラグ Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/hooks/useSimulationMode.ts (1)
190-243:⚠️ Potential issue | 🟠 Major無効な
segmentIndexRefでウェイポイント空配列になり自動進行が停止し得ます。駅リスト更新(方面/路線切替など)で
segmentIndexRef.currentが範囲外になるとcurrentSegmentStationIndex === -1となり、waypointsが空のままstepが早期 return し続けます。ここはインデックス不正時にリセット/クランプするガードを入れておくのが安全です。修正案(インデックス不正時にリセット)
const currentSegmentStation = maybeRevsersedStations[segmentIndexRef.current]; const currentSegmentStationIndex = maybeRevsersedStations.findIndex( (s) => s.id === currentSegmentStation?.id ); + if (currentSegmentStationIndex === -1) { + segmentIndexRef.current = 0; + childIndexRef.current = 0; + segmentProgressDistanceRef.current = 0; + return; + } @@ const nextStopStationIndex = maybeRevsersedStations.findIndex( (s) => s.id === nextStopStation.id ); + if (nextStopStationIndex === -1) { + segmentIndexRef.current = 0; + childIndexRef.current = 0; + segmentProgressDistanceRef.current = 0; + return; + }
Summary by CodeRabbit
New Features
Refactor
Tests