fix: stay on current view after profile/region change#98
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
41aae2f to
f384b40
Compare
This comment was marked as resolved.
This comment was marked as resolved.
- Keep current view instead of popping stack to find refreshable view - Extract viewStack helpers (popView, navigateBack, pushOrClearStack) - Call Init() on back navigation to ensure view is properly initialized - Add nil guard to refreshCurrentView for safety - Add doc comments and debug logging per code review - Add edge case tests (empty stack, nil view, refreshable verification)
f384b40 to
6774690
Compare
Pull Request Review: Fix Profile/Region Stay on Current ViewSummaryThis PR improves the user experience by keeping users on their current view when switching profiles or regions, rather than popping the view stack to find a refreshable view. The changes also consolidate view stack manipulation logic into well-named helper methods. ✅ Code Quality & Best PracticesStrengths:
Suggestions:
✅ Potential Bugs & IssuesGood catches:
No bugs found - The implementation is solid and handles edge cases appropriately. ✅ Performance ConsiderationsPositive:
No concerns - Performance is unchanged or slightly improved due to reduced code paths. ✅ Security ConcernsNo security issues identified - This is purely a UI/UX refactoring with no security implications. ✅ Test CoverageExcellent test coverage:
Minor suggestion: if cmd == nil {
t.Fatal("Expected non-nil cmd for refreshable view")
}
// Optional: Execute cmd and verify it returns RefreshMsg
msg := cmd()
if _, ok := msg.(view.RefreshMsg); !ok {
t.Errorf("Expected RefreshMsg, got %T", msg)
}📊 Architecture AlignmentThis change aligns well with the architecture documented in
🎯 Overall AssessmentRating: Excellent ⭐⭐⭐⭐⭐ This is a well-crafted PR that:
Recommendation: Approve and merge ✅ The minor suggestions above are optional improvements, not blockers. The PR is ready to merge as-is. 📝 Nitpicks (Optional)
Great work! This is exactly the kind of refactoring that improves both UX and code maintainability. 🚀 |
Summary
popView()/navigateBack()/pushOrClearStack()に集約し重複排除Init()を呼び出すことでビューが正しく初期化されるよう修正Changes
refreshCurrentView(): 現在ビューが Refreshable ならRefreshMsgを送信、そうでなければSetSizeのみnavigateBack(): pop した view に対してInit()+SetSize()を実行refreshCurrentViewで currentView が nil の場合の安全対策)Testing