Repository navigation
Androidでバックグラウンド復帰後にメイン画面から前の画面へ戻れなくなる問題を修正 - #6500
Merged
Merged
Conversation
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014bHiqssWo9t7sekdVNiMMP
Contributor
|
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 (4)
📝 WalkthroughWalkthrough変更概要
ChangesSelectLine履歴復元
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant MainScreen
participant useEnsureSelectLineInHistory
participant Navigation
MainScreen->>useEnsureSelectLineInHistory: フックを実行
useEnsureSelectLineInHistory->>Navigation: getState()
Navigation-->>useEnsureSelectLineInHistory: ナビゲーション状態を返す
useEnsureSelectLineInHistory->>Navigation: CommonActions.resetをdispatch
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
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.
概要
Android でメイン画面へ遷移したあとアプリをバックグラウンドへ移し、OS が Activity を破棄した状態から復帰すると、戻る操作で前の画面(路線選択画面)へ戻れなくなる問題を修正しました。
変更の種類
変更内容
useEnsureSelectLineInHistoryフックを新規追加。Main画面マウント時にナビゲーション状態を検査し、スタックがMain単独で初期化されていた場合のみCommonActions.resetでSelectLineを履歴の下へ差し込むMainルートのkeyを引き継ぐことでMainの再マウントとbeforeRemove(乗車状態リセット)の発火を防止Main画面で同フックを呼び出しkey保持・通常遷移時の no-op を検証するユニットテストを追加原因
MainStackはinitialRouteName={selectedBound ? 'Main' : 'SelectLine'}でスタックを初期化します。Android ではバックグラウンド中に OS が Activity を破棄すると、復帰時に JS ランタイム(Jotai のselectedBound)は生存したまま React ツリーだけが再構築されるため、スタックが[Main]単独で初期化され履歴にSelectLineが存在しませんでした。その結果、戻る操作で pop する先がなくアプリがバックグラウンドへ落ちるだけになっていました。テスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ること関連Issue
スクリーンショット(任意)
Summary by CodeRabbit
不具合修正
テスト