Skip to content

feat: Implement issues 811, 812, 813, 814 - #827

Open
cryptBeckley wants to merge 4 commits into
conduit-protocol:mainfrom
cryptBeckley:feat/multi-811-812-813-814
Open

cryptBeckley wants to merge 4 commits into
conduit-protocol:mainfrom
cryptBeckley:feat/multi-811-812-813-814

Conversation

@cryptBeckley

Copy link
Copy Markdown
Contributor

Summary

This PR addresses four related UX and resilience issues across stream realtime updates, balance caching, and error reporting:

  1. hooks/useStreamRealtime.ts: add exponential backoff when Horizon SSE connection disconnects #811: Add exponential backoff with jitter (Math.min(1000 * 2 ** retryCount, 30000)) when Horizon SSE disconnects to prevent 429 rate limits.
  2. hooks/useTokenBalance.ts: debounce rapid balance refetch requests within 2 second window #812: Add 2000ms debounce cache in hooks/useTokenBalance.ts to deduplicate parallel balance queries from simultaneously mounting components.
  3. hooks/useWalletBalance.ts: cache native XLM balance in localStorage for instant optimistic display #813: Cache native XLM balance in localStorage under cached_xlm_balance for instant optimistic display on page refresh.
  4. app/error.tsx: add 'Report Bug to GitHub' button pre-filling repository issue template #814: Add "Report Bug to GitHub" button in app/error.tsx pre-filling the repository bug report template with browser version and error stack trace.

Changes by Issue

#811 — Horizon SSE Exponential Backoff

  • Implemented calculateBackoff with exponential backoff and jitter capped at 30 seconds.
  • Replaced unthrottled immediate SSE reconnects in hooks/useStreamRealtime.ts with delayed reconnect logic.
  • Reset retry counter upon receiving operations or successful stream connection.
  • Added comprehensive unit tests in hooks/__tests__/useStreamRealtime.test.tsx.

#812 — Debounce Token Balance Queries

  • Added getCachedTokenBalanceFetch with a 2000ms debounce cache to deduplicate simultaneous balance requests for identical (address, token) pairs.
  • Configured staleTime: 2000 in useTokenBalance.
  • Updated invalidateTokenBalance to clear the debounce cache so post-deposit transactions immediately reflect the updated balance.
  • Added unit tests in hooks/__tests__/balanceHooks.test.tsx.

#813 — Optimistic Native XLM Balance

  • Added getCachedXlmBalance and setCachedXlmBalance to read and write cached_xlm_balance in localStorage.
  • Configured useWalletBalance to use initialData from localStorage, avoiding skeleton loading flicker during page reloads.
  • Automatically persists fresh balances on fetch completion.
  • Added unit tests in hooks/__tests__/balanceHooks.test.tsx.

#814 — Pre-filled GitHub Bug Report Button

  • Added buildGitHubIssueBody and buildGitHubIssueUrl in lib/error-report.ts matching .github/ISSUE_TEMPLATE/bug_report.md.
  • Added "Report Bug to GitHub" button in app/error.tsx.
  • Pre-fills error message, stack trace, current route, and browser user agent.
  • Added unit tests in lib/error-report.test.ts and app/__tests__/error.test.tsx.

Issue Closures

Closes #811
Closes #812
Closes #813
Closes #814

@drips-wave

drips-wave Bot commented Oct 19, 2026

Copy link
Copy Markdown

@cryptBeckley 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment