Skip to content

fix(ADFA-3790): Reset push/pull state after internet error#1228

Merged
dara-abijo-adfa merged 3 commits into
stagefrom
ADFA-3790-reset-pull-push-error-states
Apr 22, 2026
Merged

fix(ADFA-3790): Reset push/pull state after internet error#1228
dara-abijo-adfa merged 3 commits into
stagefrom
ADFA-3790-reset-pull-push-error-states

Conversation

@dara-abijo-adfa
Copy link
Copy Markdown
Contributor

Reset pull states when there is an internet error

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 50f8ed08-e0b7-495e-88a8-7f50aede2fab

📥 Commits

Reviewing files that changed from the base of the PR and between 23ef79f and 5165c10.

📒 Files selected for processing (1)
  • app/src/main/java/com/itsaky/androidide/viewmodel/GitBottomSheetViewModel.kt

📝 Walkthrough

Release Notes

  • Fixed push/pull state management during internet errors: Network connectivity checks have been moved inside the coroutine scope for both push() and pull() operations, ensuring that the UI state is no longer set to "Pushing" or "Pulling" when no internet connection is detected.

  • Improved error handling flow: When an internet connection is unavailable, the operations now immediately set the state to "Error" with the R.string.no_internet_connection message, rather than briefly showing a loading state before failing.

  • More responsive error feedback: Users will now see appropriate error messages immediately when attempting to push or pull without internet connectivity, improving the overall user experience during offline scenarios.

Walkthrough

The push() and pull() methods in the Git ViewModel were refactored to move network connectivity checks inside the coroutine scope. This ensures UI state transitions (Pushing/Pulling) only occur after confirming network availability, rather than being set preemptively before validation.

Changes

Cohort / File(s) Summary
Git ViewModel State Management
app/src/main/java/com/itsaky/androidide/viewmodel/GitBottomSheetViewModel.kt
Restructured push() and pull() methods: moved NetworkUtils.isConnected() checks into coroutine scope, converted early return to return@launch, and deferred UI state assignment (_pushState/_pullState) to execute only after network validation succeeds.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A hop through the network, we now wait to see,
If the connection exists before loading we be,
No premature states dancing when offline we stray,
Just careful, kind checks to save the UI's day!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title focuses on resetting states after internet error, but the actual changes move network checks into coroutines and set states only after validation, which is a control flow refactoring rather than a state reset fix. Clarify whether the title should reflect the control flow changes (moving checks into coroutines) or if it accurately describes the intended behavior change from the developer's perspective.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description mentions resetting pull states on internet error, which aligns with the changeset's goal of deferring state updates until after network validation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ADFA-3790-reset-pull-push-error-states

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dara-abijo-adfa dara-abijo-adfa force-pushed the ADFA-3790-reset-pull-push-error-states branch from 8b8eaf7 to ddea1c0 Compare April 21, 2026 19:17
@dara-abijo-adfa dara-abijo-adfa changed the title fix(ADFA-3970): Reset push/pull state after internet error fix(ADFA-3790): Reset push/pull state after internet error Apr 21, 2026
@dara-abijo-adfa dara-abijo-adfa merged commit bbc7cfa into stage Apr 22, 2026
2 checks passed
@dara-abijo-adfa dara-abijo-adfa deleted the ADFA-3790-reset-pull-push-error-states branch April 22, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants