Merged
Conversation
showNextExpressionで`arrived`チェックが`getIsPass`チェックより前にあったため、 通過駅に到着した際にshowNextExpressionがfalseを返し、ヘッダーが通過駅名を 表示していた。通過駅チェックを到着チェックの前に移動することで修正。 https://claude.ai/code/session_019vrAoQbcYcG1WcG41D2qe5
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
Contributor
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/hooks/useTransitionHeaderState.ts (1)
140-163: ロジック変更は正しく、PRの目的に沿っています。通過駅では到着中でも次の停車駅を表示するようになり、意図した動作です。
ただし、リファクタリングの余地があります: Line 150-152で
arrivedがtrueの場合は既にreturnしているため、Line 154の&& !arrivedとLine 162の!arrived &&は冗長になっています。♻️ 冗長な条件の削除
// 急行停車駅発車直後trueにする - if (stationForHeader?.id === station?.id && !arrived) { + if (stationForHeader?.id === station?.id) { return true; } // 地理的な最寄り駅と次の停車駅が違う場合場合 かつ 次の停車駅に近づいていなければtrue if (stationForHeader?.id !== station?.id && !approaching) { return true; } // 地理的な最寄り駅と次の停車駅が同じ場合に到着していない かつ 接近もしていない場合true - return !arrived && !approaching; + return !approaching;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/hooks/useTransitionHeaderState.ts` around lines 140 - 163, The computed showNextExpression in useTransitionHeaderState.ts contains redundant arrived checks; remove the unnecessary "&& !arrived" in the branch that checks "stationForHeader?.id === station?.id && !arrived" and remove the "!arrived &&" in the final return since earlier branches already return when arrived is true—leave the initial arrived check (if (arrived) return false) intact and update the memo dependencies as-is so the remaining conditions (stationForHeader?.id === station?.id, stationForHeader?.id !== station?.id && !approaching, and final return !approaching) reflect the same logic without duplicated arrived guards.
🤖 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/useTransitionHeaderState.ts`:
- Around line 140-163: The computed showNextExpression in
useTransitionHeaderState.ts contains redundant arrived checks; remove the
unnecessary "&& !arrived" in the branch that checks "stationForHeader?.id ===
station?.id && !arrived" and remove the "!arrived &&" in the final return since
earlier branches already return when arrived is true—leave the initial arrived
check (if (arrived) return false) intact and update the memo dependencies as-is
so the remaining conditions (stationForHeader?.id === station?.id,
stationForHeader?.id !== station?.id && !approaching, and final return
!approaching) reflect the same logic without duplicated arrived guards.
早期リターン`if (arrived) return false`の後では`arrived`は常にfalseのため、 後続の`&& !arrived`および`!arrived &&`ガードは不要。 https://claude.ai/code/session_019vrAoQbcYcG1WcG41D2qe5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
showNextExpressionの条件順序を変更し、通過駅チェック (getIsPass) をarrivedチェックの前に移動showNextExpression = trueとなり、ヘッダーが「次は」状態で次の停車駅名を正しく表示する原因
showNextExpressionで!nextStation || arrivedを一括で早期リターンしていたため、通過駅に到着した際(arrived = true)にgetIsPassチェックに到達せず、ヘッダーがCURRENT状態のまま通過駅名を表示していた。変更内容
src/hooks/useTransitionHeaderState.ts:!nextStationとarrivedの条件を分離getIsPass) をarrivedチェックの前に配置Test plan
npm run lint— passednpm run typecheck— passednpm test— 136 suites, 1257 tests all passedhttps://claude.ai/code/session_019vrAoQbcYcG1WcG41D2qe5
Summary by CodeRabbit
リリースノート