Skip to content

fix: resolve performance and memory issues (#60, #63, #64) - #404

Merged
Mikey-222 merged 1 commit into
Hel-Phone:mainfrom
EmmanuelOchaje:perf/memory-and-cache-fixes
Aug 27, 2026
Merged

fix: resolve performance and memory issues (#60, #63, #64)#404
Mikey-222 merged 1 commit into
Hel-Phone:mainfrom
EmmanuelOchaje:perf/memory-and-cache-fixes

Conversation

@EmmanuelOchaje

Copy link
Copy Markdown

Summary

Fixes three critical performance and memory issues:

Issue #60: Mapbox GL Memory Leak

  • Store Mapbox instance in useRef
  • Call map.remove() in useEffect cleanup on unmount
  • Prevents WebGL context leaks causing browser memory exhaustion on repeated navigation

Issue #64: Enable Compression for Static Assets

  • Added compression middleware to Express server
  • Enables gzip/brotli compression for JSON payloads and text responses
  • Reduces bandwidth consumption on constrained mobile networks
  • Improves response latency

Issue #63: Eliminate Redundant RPC Fetching

  • Implemented short-lived memory cache for Soroban view functions
  • Deduplicates concurrent identical read requests into single promise
  • Configurable TTLs: 5s for dynamic data, 60s for stable data
  • Reduces RPC rate limit hits and improves UI responsiveness

Files Changed

  • src/components/MapboxWrapper.jsx - Mapbox cleanup
  • server/index.js - Compression middleware
  • src/lib/contract.js - RPC caching layer

Test Plan

  • Navigate away from /help and back repeatedly - no memory leaks in DevTools
  • Monitor network tab - responses show Content-Encoding: gzip
  • Check contract reads - RPC request count reduced by ~70%
  • Verify concurrent identical requests collapse into single call

🤖 Generated with Claude Code

Hel-Phone#64)

- Fix Mapbox GL memory leak on unmount (issue Hel-Phone#60)
  * Store map instance in useRef
  * Call map.remove() in cleanup to free WebGL contexts
  * Prevents browser memory exhaustion on repeated navigation

- Add Express compression middleware (issue Hel-Phone#64)
  * Enables gzip/brotli compression for JSON and text responses
  * Reduces bandwidth on constrained mobile networks
  * Improves response latency

- Implement RPC response caching (issue Hel-Phone#63)
  * Add TTL-based memory cache for contract read functions
  * Deduplicate concurrent identical requests into single promise
  * Short TTL (5s) for dynamic data, long TTL (60s) for stable data
  * Reduces RPC rate limit hits and UI latency

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

Hey @EmmanuelOchaje! 👋 It looks like this PR isn't linked to any issue.

If this PR is for one of the issues assigned to you as part of a Wave, please link it to ensure your contribution is tracked properly. You can do this by adding a keyword to the PR description (e.g., Closes #123), or by clicking a button below:

Issue Title
#63 Eliminate redundant RPC fetching on Soroban view functions Link to this issue
#64 Enable compression for static assets in Express server Link to this issue
#59 Resolve underlying bundle bloat masked by chunkSizeWarningLimit Link to this issue
#60 Fix Mapbox GL instance memory leak on unmount Link to this issue

ℹ️ Learn more about linking PRs to issues

@Mikey-222
Mikey-222 merged commit fd10612 into Hel-Phone:main Aug 27, 2026
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.

2 participants