feat: add offline support with data caching, connectivity monitoring,… - #1138
Merged
mikewheeleer merged 4 commits intoAug 30, 2026
Conversation
… and mutation guards
…online status, and cache clearance error handling
|
@Oluwasuyi-Oluwatimilehin-Daniel Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds an offline-aware read mode for previously loaded contracts on the contract detail page (
/contracts/[id]). Temporary connectivity loss no longer erases loaded contract data or leaves the page in an unusable blank state.Key capabilities introduced:
localStorageup to a bounded 50 entries (MAX_CACHE_ENTRIES = 50) using chronological LRU eviction,schemaVersion: 1, and staleness detection (5-minute threshold).isBrowser().useOnlineStatushook tracks browser network changes in real time via windowonline/offlineevents.OfflineIndicatordisplays offline and stale state notices with relative cached timestamps ("Cached 5 minutes ago") withrole="status"andaria-live="polite".Submit Milestone,Release Funds,Dispute, inline milestone edits) when offline or viewing stale snapshots, with clear tooltips and error toasts.Closes #1131
Type of Change
Pre-flight Checklist
All items must be checked before requesting review.
npm run lintpasses with no errorsnpm testpasses with no failuresnpm run buildcompletes successfullyTesting & Coverage
(run
npm test -- --coverageand check the per-file table)the shared utilities in
src/test-utils/a11y.tsxWhat was tested?
contractCache.test.ts(14 unit tests):useOnlineStatus.test.ts(6 unit tests):navigator.onLine(including undefined fallback).offlineandonlineevents.OfflineIndicator.test.tsx(9 component & a11y tests):jest-axeautomated accessibility audits with 0 violations.ActionPanel.test.tsx(41 unit & a11y tests):disableMutationsprop disables submit, release, and dispute actions with informative tooltip titles while keepingView Summaryaccessible.assertNoA11yViolationschecks in normal, open dispute form, and mutation-disabled states.offlineReadMode.test.tsx&page.test.tsx(52 integration tests):onlineevent triggers automatic fresh data re-fetch, clears offline banner, and re-enables mutations.Accessibility & Security Notes
Accessibility
jest-axeaccessibility scans andassertNoA11yViolationsagainstOfflineIndicatorandActionPanelin all states (0 violations).OfflineIndicatorusesrole="status",aria-live="polite", andaria-labelto announce network state changes cleanly without disrupting screen reader focus.titleandaria-describedbytooltips explaining why mutations are disabled when offline or viewing stale snapshots.Security
ContractData). Wallet private keys, secrets, session authentication tokens, and tenant boundaries are never stored in localStorage.