feat(activity): handle offline with cached data staleness #315

Merged
fuzzy merged 1 commit from phase06-offline into main 2026-07-07 11:18:50 +00:00
Owner

What

Add explicit offline/stale state tracking to the View, completing #242.

Changes

  • IsStale() — returns true when the View has cached data but last fetch failed (lastError != nil && loaded)
  • statusLine — shows "offline - cached data" instead of "stale data" for clearer state
  • Existing RefreshContext graceful degradation (returns cached data on fetch failure)
  • Last successful fetch timestamp shown in header
  • Window data accessible via .Window() even when offline

References: #242, #239, #240, #241

Testing

  • 3 new tests: IsStale after failed refresh, IsStale after successful refresh, navigation with cached data
  • go test -race ./... — all pass (0 races)
## What Add explicit offline/stale state tracking to the View, completing #242. ### Changes - **IsStale()** — returns true when the View has cached data but last fetch failed (`lastError != nil && loaded`) - **statusLine** — shows `"offline - cached data"` instead of `"stale data"` for clearer state - Existing `RefreshContext` graceful degradation (returns cached data on fetch failure) - Last successful fetch timestamp shown in header - Window data accessible via `.Window()` even when offline References: #242, #239, #240, #241 ## Testing - [x] 3 new tests: IsStale after failed refresh, IsStale after successful refresh, navigation with cached data - [x] `go test -race ./...` — all pass (0 races)
feat(activity): handle offline with cached data staleness
All checks were successful
Test and Release / test (pull_request) Successful in 3m52s
Test and Release / lint (pull_request) Successful in 4m25s
c74ef9f88f
- IsStale() method: returns true when View has cached data but
  last fetch failed (lastError != nil && loaded)
- statusLine shows 'offline - cached data' instead of 'stale data'
  for clearer state indication
- Existing functionality preserved:
  - RefreshContext returns cached data on fetch errors (graceful
    degradation)
  - Last successful fetch timestamp shown in header
  - Navigation/cached data access works even when offline
- Tests: IsStale after failed refresh (fresh), IsStale after
  success, navigation with cached data

Ref: #242, #239, #240, #241
fuzzy added this to the Steeper project 2026-07-07 11:14:57 +00:00
fuzzy self-assigned this 2026-07-07 11:14:58 +00:00
fuzzy scheduled this pull request to auto merge when all checks succeed 2026-07-07 11:15:00 +00:00
the.auditor left a comment

Review

Result: Approved — no blocking issues.

Summary: Adds offline/stale state tracking to View. IsStale() method returns true when lastError != nil && loaded (cached data exists but fetch failed). Status line indicator changed from "stale data" to "offline - cached data" for clarity. Window data remains accessible via Window() and Render() even when offline. ROADMAP2.md updated.

Non-blocking:

  • #316 — Add godoc for exported IsStale

Checklist:

  • Correctness: IsStale correctly identifies offline state (error + existing data)
  • Completeness: Closes #242 — renders from cache with indicator, shows last fetch timestamp, allows navigation
  • Test coverage: 3 new tests (IsStale after failure, IsStale after success, navigation with cached data)
  • Race-safe: Mutex on IsStale, go test -race passes
  • Maintainability: Minimal 7-line change, clear semantics
## Review **Result: Approved** — no blocking issues. **Summary:** Adds offline/stale state tracking to `View`. `IsStale()` method returns `true` when `lastError != nil && loaded` (cached data exists but fetch failed). Status line indicator changed from "stale data" to "offline - cached data" for clarity. Window data remains accessible via `Window()` and `Render()` even when offline. ROADMAP2.md updated. **Non-blocking:** - #316 — Add godoc for exported `IsStale` **Checklist:** - Correctness: ✅ IsStale correctly identifies offline state (error + existing data) - Completeness: ✅ Closes #242 — renders from cache with indicator, shows last fetch timestamp, allows navigation - Test coverage: ✅ 3 new tests (IsStale after failure, IsStale after success, navigation with cached data) - Race-safe: ✅ Mutex on IsStale, `go test -race` passes - Maintainability: ✅ Minimal 7-line change, clear semantics
fuzzy merged commit c74ef9f88f into main 2026-07-07 11:18:50 +00:00
fuzzy deleted branch phase06-offline 2026-07-07 11:18:50 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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
thwap/steeper!315
No description provided.