fix & enhance(frontend): resolve network banner render loop and imple…#228
Open
EzeanoroEbuka wants to merge 2 commits into
Open
Conversation
…ment image compression - Fix infinite re-render loop in `NetworkMismatch.tsx` by optimizing `useEffect` dependency array and validating chain ID states. - Integrate `browser-image-compression` in `ImageCapture.tsx` to downsize delivery proof uploads below 500KB. - Add a loading state (Compressing...) on the upload button during image processing. Closes SwiftChainn#154 Closes SwiftChainn#161
|
@EzeanoroEbuka 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.
Pull Request Description
🚀 Summary of Work Done
This PR combines a critical performance fix for the wallet network banner and a data-saving enhancement for client-side image uploads.
Network Mismatch Banner Fix (#154): Audited and corrected the useEffect dependency array inside components/wallet/NetworkMismatch.tsx. State updates are now strictly bypassed if the connected chain ID matches the target environment chain ID, successfully breaking the infinite re-render loop.
Proof of Delivery Image Compression (#161): Integrated browser-image-compression within components/logistics/ImageCapture.tsx. Heavy raw camera images are now compressed down below 500KB on the client side before upload. A visual 'Compressing...' state has been added to the upload button to manage UI feedback.
🛠️ Technical Implementation Details
Architecture: Follows the mandatory Component -> Hook -> Service architecture pattern.
Performance: React Profiler verified. Rendering cycles sit at a stable baseline of 1 after network resolution, preventing idle re-renders.
Data Integrity: No mock objects or hardcoded items were introduced; API endpoints handle real network data configurations.
📌 PR Requirements & Acceptance Criteria
Closes #154
Closes #161