Skip to content

Conversation

@vignesh07
Copy link
Contributor

Summary

When all providers are disabled, the fallback provider (.codex) would still trigger animation because:

  • isVisible(.codex) returned true (fallback)
  • But hasData was false (no fetch ever ran)
  • So shouldAnimate() returned true → 60fps animation loop forever

This caused unnecessary CPU usage and battery drain.

The Fix (5 lines)

// Don't animate for fallback provider - it's only shown as a placeholder
// when nothing is enabled. Animating the fallback causes unnecessary
// CPU usage (battery drain). See #269, #139.
let isEnabled = self.isEnabled(provider)
let isFallbackOnly = !isEnabled && self.fallbackProvider == provider
if isFallbackOnly { return false }

Testing

Added BatteryDrainDiagnosticTests.swift with tests that verify:

  • ✅ Animation driver should be nil when all providers disabled
  • ✅ Animation driver should be nil when provider has data
  • ✅ Idle state should have no active animation or refresh

Fixes #269, #139

vignesh07 and others added 2 commits February 1, 2026 01:46
When all providers are disabled, the fallback provider (.codex) would still
trigger animation because:
- isVisible(.codex) returned true (fallback)
- But hasData was false (no fetch ever ran)
- So shouldAnimate() returned true → 60fps animation loop forever

This caused unnecessary CPU usage and battery drain.

The fix: detect when a provider is only visible as a fallback (not actually
enabled) and skip animation for it.

Fixes steipete#269, steipete#139
@steipete steipete force-pushed the fix/battery-drain-fallback-animation branch from fe2d4f3 to f7ba013 Compare February 1, 2026 09:47
@steipete steipete merged commit b1b42f0 into steipete:main Feb 1, 2026
3 of 4 checks passed
@steipete
Copy link
Owner

steipete commented Feb 1, 2026

Landed via temp rebase onto main.\n\n- Gate: pnpm lint && pnpm build && pnpm test\n- Land commit: f7ba013\n- Merge commit: b1b42f0\n\nThanks @vignesh07!

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.

Significant usage of battery

2 participants