Skip to content

refactor(home): drop the isReloading guard that could never fire - #935

Merged
QuantumExplorer merged 1 commit into
developfrom
claude/remove-home-isreloading
Aug 7, 2026
Merged

refactor(home): drop the isReloading guard that could never fire#935
QuantumExplorer merged 1 commit into
developfrom
claude/remove-home-isreloading

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Aug 7, 2026

Copy link
Copy Markdown
Member

Raised by CodeRabbit on #931, and deliberately left out of that PR to keep a CrowdNode-focused change from expanding into pre-existing develop code.

The problem

HomeViewModel.isReloading is dead. performReload sets it true on entry and back to false before returning; onTransactionStatusChanged then checks it from inside queue.async. Both run on the same serial queue, so the reload has always completed — and reset the flag — before the guard can run. It never observes true.

The comment on that guard claimed it would

Skip incremental updates while a full reload is in progress to prevent race conditions that could cause missing transactions

which describes protection that does not exist. That is the failure mode CLAUDE.md guardrail #2 exists to prevent: anyone auditing the feed for dropped transactions would have credited a guard that does nothing.

Verification of the serial-queue premise

Checked before deleting, since a concurrent queue would have made the guard live:

  • queue is DispatchQueue(label: "HomeViewModel", qos: .userInitiated) — no attributes: .concurrent, so serial.
  • performReload has exactly one caller, itself inside queue.async.
  • No top-level early return, await, or re-dispatch between the true and false assignments — the body is synchronous, so the flag cannot leak past the call.
  • isReloading is referenced nowhere outside HomeViewModel.swift.

Changes

Removes the property, all three assignments (performReload entry/exit and the network-change handler), and the guard with its comment. Two neighbouring comments are trimmed so they stop describing a flag that no longer exists:

  • Reset load tracking flagsReset load tracking
  • Fix #2 & #3: Mark initial load complete and clear reload flagFix #2: Mark initial load complete

No behavior change — the guard's body was unreachable.

Testing

Clean dashpay build, ** BUILD SUCCEEDED **:

xcodebuild -workspace DashWallet.xcworkspace -scheme dashpay -sdk iphonesimulator \
  -destination 'generic/platform=iOS Simulator' ARCHS=arm64 build

The unit-test target is still broken on develop (pre-existing), so the build is the verification standard here.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved transaction updates by allowing incremental changes to appear while a full refresh is in progress.
    • Streamlined refresh behavior to provide more consistent loading and synchronization results.

`performReload` set `isReloading = true` on entry and back to false before
returning, and `onTransactionStatusChanged` checked the flag from inside
`queue.async`. Both run on the same serial `queue`, and `performReload` has a
single caller — also inside `queue.async` — with no early return, `await`, or
re-dispatch between the two assignments. So the reload always finished, and
reset the flag, before the guard could run: it never observed `true`.

That made the accompanying comment wrong in the way guardrail #2 forbids. It
claimed to "skip incremental updates while a full reload is in progress to
prevent race conditions that could cause missing transactions" — describing
protection the code did not provide. A reader auditing the feed for lost
transactions would have credited a guard that does nothing.

Removes the property, all three assignments, and the guard. Two neighbouring
comments are trimmed so they no longer describe a flag that is gone.

No behavior change: the guard's body was unreachable.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: effcfdee-f719-4254-b69c-dbfb77eecd5c

📥 Commits

Reviewing files that changed from the base of the PR and between 82501ae and f59d9c2.

📒 Files selected for processing (1)
  • DashWallet/Sources/UI/Home/Views/HomeViewModel.swift

📝 Walkthrough

Walkthrough

HomeViewModel removes the private full-reload state flag. Network cache resets retain initial-load tracking, and incremental transaction updates are no longer blocked during full reloads.

Changes

Home reload state

Layer / File(s) Summary
Remove full reload gating
DashWallet/Sources/UI/Home/Views/HomeViewModel.swift
Removes isReloading from cache reset, full reload start and completion, and incremental transaction update handling. Initial-load tracking remains active.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: llbartekll, jeanpierreroma

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Linked Issues check ❓ Inconclusive The changes match the refactoring objective, but linked issue #2 provides no detailed coding requirements for full compliance validation. Provide acceptance criteria or implementation requirements for issue #2 to confirm that the refactoring satisfies its intended scope.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: removing the ineffective isReloading guard from HomeViewModel.
Out of Scope Changes check ✅ Passed The changes are limited to removing isReloading logic and updating related comments in HomeViewModel.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/remove-home-isreloading

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

@QuantumExplorer
QuantumExplorer merged commit 30d9112 into develop Aug 7, 2026
1 of 3 checks passed
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.

1 participant