Skip to content

fixed wallet disconnect - #476

Merged
ExcelDsigN-tech merged 2 commits into
ExcelDsigN-tech:mainfrom
Marvell69:fix/wallet-disconnect
Aug 25, 2026
Merged

fixed wallet disconnect#476
ExcelDsigN-tech merged 2 commits into
ExcelDsigN-tech:mainfrom
Marvell69:fix/wallet-disconnect

Conversation

@Marvell69

Copy link
Copy Markdown
Contributor

Fix Wallet Disconnect, Localization Gaps, Offline Support & Real-Time Events

Summary

This PR addresses four important frontend/platform issues affecting wallet reliability, localization, offline usability, and real-time user feedback.

The changes improve wallet disconnect/reconnect behavior, complete missing Spanish and Tagalog translations, introduce offline-first capabilities for critical borrower workflows, and add real-time event handling through Server-Sent Events (SSE).

The goal is to improve reliability and accessibility without changing existing core business logic or user-facing APIs unnecessarily.

What Changed

1. Fix Wallet Disconnect & Stale Service Worker State

Updated frontend/src/app/components/WalletProvider.tsx to properly clean up wallet-related state when a user disconnects.

Changes

  • Unregister active service workers during wallet disconnect.

  • Clear wallet-related data from:

    • IndexedDB
    • localStorage
    • sessionStorage
    • Relevant PWA/cache storage
  • Force a page reload after disconnect to ensure stale authentication and wallet state cannot persist.

  • Verify the disconnect → reconnect flow.

  • Test behavior across:

    • Freighter
    • Albedo
    • XBull

Why

A stale service worker can retain outdated authentication or wallet state, resulting in failed transactions, broken reconnect attempts, and potentially unsafe stale application state.


2. Complete Spanish & Tagalog Message Catalogs

Updated the frontend message catalogs under:

frontend/src/app/[locale]/messages/

Changes

  • Audited en.json for the complete set of message keys.
  • Added missing Spanish (es) translations.
  • Added missing Tagalog (tl) translations.
  • Added validation to detect missing translation keys during CI.
  • Verified language switching across key loan application, cash-in/out, and dispute flows.
  • Documented the translation review workflow.

Why

Missing translations currently cause English fallbacks or untranslated message keys for users relying on Spanish or Tagalog, particularly across critical financial workflows.


3. Add Offline Support for Critical Borrower Workflows

Introduced offline capabilities for borrowers and agents operating with unreliable connectivity.

Changes

  • Added Workbox-based service worker caching.
  • Added IndexedDB storage for pending offline actions.
  • Added a queue for repayments initiated while offline.
  • Added Background Sync for retrying queued actions once connectivity returns.
  • Added offline status UI with queued-action visibility.
  • Added conflict-resolution handling for concurrent changes.
  • Followed existing component and state-management patterns.

Supported Offline Workflows

  • Viewing loan details.
  • Viewing repayment schedules.
  • Queueing eligible repayments while offline.
  • Automatically retrying queued actions after connectivity is restored.

Why

Users in areas with intermittent connectivity should not lose access to important loan information or have their repayment attempts silently fail because of temporary network loss.


4. Add Real-Time Event Streaming with SSE

Added real-time frontend infrastructure for receiving important application events without relying on frequent polling.

Supported Events

  • loan_status
  • repayment
  • dispute
  • settlement

Changes

  • Added the SSE endpoint:
    GET /api/events/stream
  • Added Redis pub/sub support for multi-instance event broadcasting.
  • Added a reusable useEventStream React hook under frontend/src/app/hooks/.
  • Added automatic connection recovery.
  • Implemented exponential backoff for interrupted connections.
  • Added support for multi-instance deployments.

Why

Real-time updates provide immediate feedback for important financial events such as repayment confirmations, loan-status changes, dispute updates, and settlement completion.

Files / Areas Affected

Wallet

  • frontend/src/app/components/WalletProvider.tsx

Closes #418
Closes #421
Closes #425
Closes #431

@drips-wave

drips-wave Bot commented Aug 25, 2026

Copy link
Copy Markdown

@Marvell69 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! 🚀

Learn more about application limits

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 35b783a9-a8f8-4f96-a0bc-4792198bb7a8


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.

await logoutBtn.scrollIntoViewIfNeeded();

// Click and wait for navigation/reload that our app triggers
const [response] = await Promise.all([
@ExcelDsigN-tech
ExcelDsigN-tech merged commit 488d81c into ExcelDsigN-tech:main Aug 25, 2026
14 of 22 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

3 participants