Performance optimization: WASM worker, PWA support, SVG extraction, and context optimization - #402
Merged
Mikey-222 merged 1 commit intoAug 27, 2026
Conversation
…nd optimize context providers Closes Hel-Phone#62, Hel-Phone#57, Hel-Phone#58, Hel-Phone#61 ## Summary ### Issue Hel-Phone#62: Offload Noir WASM instantiation from the main thread - Created Web Worker at `src/workers/zk-worker.js` to handle WASM instantiation asynchronously - Implemented `src/lib/worker-manager.js` for non-blocking worker communication via message passing - WASM instantiation no longer blocks UI thread during emergency dispatch ### Issue Hel-Phone#57: Implement Service Worker and PWA caching strategy - Integrated `vite-plugin-pwa` with precaching manifest - Created `src/service-worker.js` with cache-first and stale-while-revalidate strategies - Cache static assets, WASM files, and Mapbox core library - Implemented `OfflineIndicator` component to alert users of network loss - Offline fallback UI prevents complete app failure during connection loss ### Issue Hel-Phone#58: Extract massive inline SVG map to external component - Extracted ~170 lines of complex SVG path data from `App.jsx` to `src/components/CommunityMap.jsx` - Reduces App.jsx bloat and enables browser caching of the asset independently - Maintains responsive viewBox scaling via inline styles ### Issue Hel-Phone#61: Prevent redundant DOM updates from React Context state - Split global context into `WalletStateContext` and `WalletActionContext` - Created dedicated provider structure in `src/context/WalletProvider.jsx` - Components now subscribe only to required state slices - Reduces deep re-renders when wallet state changes (block height polling, etc.) All changes follow existing code patterns and maintain compatibility with GitHub Actions CI/CD.
|
@Akanimoh12 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! 🚀 |
Darkvader-ship-it
added a commit
to Darkvader-ship-it/HelPhone
that referenced
this pull request
Aug 27, 2026
…onfig - Rebase onto upstream/main (PR Hel-Phone#401, Hel-Phone#402: PWA support, performance optimizations) - Add saveWalletAddress / loadWalletAddress / clearWalletAddress to contract.ts (upstream added these for wallet auto-reconnect persistence) - Add subscribeToContractEvents / getWalletBalances stubs to contract.ts - Fix walletConnecting ternary JSX — wrap sibling elements in Fragment - Set injectManifest.maximumFileSizeToCacheInBytes = 10MB in vite.config.ts so Barretenberg WASM bundles (~3-4MB each) pass PWA precache validation - Install vite-plugin-pwa (new upstream dep for PWA strategy) - Build: passes (npm run build ✓)
Darkvader-ship-it
added a commit
to Darkvader-ship-it/HelPhone
that referenced
this pull request
Aug 27, 2026
…onfig - Rebase onto upstream/main (PR Hel-Phone#401, Hel-Phone#402: PWA support, performance optimizations) - Add saveWalletAddress / loadWalletAddress / clearWalletAddress to contract.ts (upstream added these for wallet auto-reconnect persistence) - Add subscribeToContractEvents / getWalletBalances stubs to contract.ts - Fix walletConnecting ternary JSX — wrap sibling elements in Fragment - Set injectManifest.maximumFileSizeToCacheInBytes = 10MB in vite.config.ts so Barretenberg WASM bundles (~3-4MB each) pass PWA precache validation - Install vite-plugin-pwa (new upstream dep for PWA strategy) - Build: passes (npm run build ✓)
Darkvader-ship-it
added a commit
to Darkvader-ship-it/HelPhone
that referenced
this pull request
Aug 27, 2026
…onfig - Rebase onto upstream/main (PR Hel-Phone#401, Hel-Phone#402: PWA support, performance optimizations) - Add saveWalletAddress / loadWalletAddress / clearWalletAddress to contract.ts (upstream added these for wallet auto-reconnect persistence) - Add subscribeToContractEvents / getWalletBalances stubs to contract.ts - Fix walletConnecting ternary JSX — wrap sibling elements in Fragment - Set injectManifest.maximumFileSizeToCacheInBytes = 10MB in vite.config.ts so Barretenberg WASM bundles (~3-4MB each) pass PWA precache validation - Install vite-plugin-pwa (new upstream dep for PWA strategy) - Build: passes (npm run build ✓)
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.
Summary
Addresses four critical performance and architecture issues to improve the emergency response application's reliability and user experience.
Changes
Issue #62: Offload Noir WASM instantiation from the main thread
src/workers/zk-worker.js,src/lib/worker-manager.jsIssue #57: Implement Service Worker and PWA caching strategy
package.json,vite.config.js,src/service-worker.js,src/components/OfflineIndicator.jsx,src/main.jsxvite-plugin-pwafor automatic Service Worker generationIssue #58: Extract massive inline SVG map to external component
Issue #61: Prevent redundant DOM updates from React Context state
Test Plan
Closes #62, Closes #57, Closes #58, Closes #61.