fix: resolve navigation, set caching, and bottom sheet bugs #8

Open
elvis wants to merge 1 commit from fix/nav-cache-sheet-bugs into master
Owner

Summary

  • Bug 1/2 (nav back stack): BottomNavBar.kt had popUpTo(Screen.Search.route) hardcoded with saveState/restoreState, corrupting the back stack so Android back always returned to Search and re-tapping a tab restored sub-screens instead of popping to root. Fixed by dropping saveState/restoreState and using a clean popUpTo + launchSingleTop.
  • Bug 3 (set cards caching): searchBySet always hit the network. Now checks set.total vs cached card count; skips the API when complete, otherwise paginates through all pages to guarantee a full cache after the first open.
  • Bug 4 (fade transition): Added enterTransition/exitTransition of 120ms to NavHost (previously used the 700ms framework default).
  • Bug 5 (sheet Add button off-screen): Changed LazyColumn from fixed height(200dp) to heightIn(max=240dp) — shrinks to content when few binders.
  • Bug 6 (back scrolls card instead of dismissing sheet): Added rememberModalBottomSheetState(skipPartiallyExpanded=true) so the sheet opens fully expanded and back correctly dismisses it.

Test plan

  • ./gradlew assembleDebug — builds clean
  • ./gradlew test — all 76 tests pass (2 new searchBySet caching tests added)
  • Manual: Search → Collection → open a binder → tap Collection tab → pops to binder list
  • Manual: back from Collection root → returns to Search; back again → exits
  • Manual: tap a set, cards load; kill network, reopen same set → cards show instantly with no spinner
  • Manual: screen transitions are a quick 120ms fade
  • Manual: tap + on a card → Add button visible without scrolling
  • Manual: with sheet open, press back → sheet dismisses (not card scrolling)
## Summary - **Bug 1/2 (nav back stack):** BottomNavBar.kt had popUpTo(Screen.Search.route) hardcoded with saveState/restoreState, corrupting the back stack so Android back always returned to Search and re-tapping a tab restored sub-screens instead of popping to root. Fixed by dropping saveState/restoreState and using a clean popUpTo + launchSingleTop. - **Bug 3 (set cards caching):** searchBySet always hit the network. Now checks set.total vs cached card count; skips the API when complete, otherwise paginates through all pages to guarantee a full cache after the first open. - **Bug 4 (fade transition):** Added enterTransition/exitTransition of 120ms to NavHost (previously used the 700ms framework default). - **Bug 5 (sheet Add button off-screen):** Changed LazyColumn from fixed height(200dp) to heightIn(max=240dp) — shrinks to content when few binders. - **Bug 6 (back scrolls card instead of dismissing sheet):** Added rememberModalBottomSheetState(skipPartiallyExpanded=true) so the sheet opens fully expanded and back correctly dismisses it. ## Test plan - ./gradlew assembleDebug — builds clean - ./gradlew test — all 76 tests pass (2 new searchBySet caching tests added) - Manual: Search → Collection → open a binder → tap Collection tab → pops to binder list - Manual: back from Collection root → returns to Search; back again → exits - Manual: tap a set, cards load; kill network, reopen same set → cards show instantly with no spinner - Manual: screen transitions are a quick 120ms fade - Manual: tap + on a card → Add button visible without scrolling - Manual: with sheet open, press back → sheet dismisses (not card scrolling)
- Bug 1/2: fix bottom nav popUpTo hardcoded to Search and remove
  saveState/restoreState so re-tapping a tab pops sub-screens and
  back from a tab root returns to Search then exits
- Bug 3: cache all set cards on first open with pagination and skip
  network when cache is complete (countBySet >= set.total)
- Bug 4: reduce NavHost fade transitions from 700ms default to 120ms
- Bug 5: switch AddToBinderSheet LazyColumn from fixed height(200dp)
  to heightIn(max=240dp) so the Add button is visible without scrolling
- Bug 6: add skipPartiallyExpanded=true to sheet state so back button
  dismisses the sheet instead of scrolling the card behind it

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/nav-cache-sheet-bugs:fix/nav-cache-sheet-bugs
git switch fix/nav-cache-sheet-bugs

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch master
git merge --no-ff fix/nav-cache-sheet-bugs
git switch fix/nav-cache-sheet-bugs
git rebase master
git switch master
git merge --ff-only fix/nav-cache-sheet-bugs
git switch fix/nav-cache-sheet-bugs
git rebase master
git switch master
git merge --no-ff fix/nav-cache-sheet-bugs
git switch master
git merge --squash fix/nav-cache-sheet-bugs
git switch master
git merge --ff-only fix/nav-cache-sheet-bugs
git switch master
git merge fix/nav-cache-sheet-bugs
git push origin master
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
elvis/pokebox!8
No description provided.