Repository navigation
fix(ui): replace DOM-mutating image fallbacks with ImageWithFallback - #239
Merged
Atharva0506 merged 1 commit intoOct 9, 2026
Merged
Conversation
The onError handlers in CountryPicker, InvoicePreview, TokenCrousel and TokenPicker hid images or swapped their src by writing to the DOM directly. React doesn't know about those writes, and a broken fallback image re-fires onError forever. ImageWithFallback keeps the failure in state instead: it tries src, then fallbackSrc, then renders a fallback node. Each source is tried once, and the state resets when src changes. Avatar now uses it, so a token whose image and generic icon both fail shows its initials. Part of StabilityNexus#122
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 36 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (6)
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. Comment |
Contributor
🔍 PR Preview
|
Contributor
|
✅ Build successful! Build Size MetricsWorkflow run · commit cc9dfe1 |
Atharva0506
marked this pull request as ready for review
October 6, 2026 09:17
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.
Addressed Issues:
Part of #122
The remaining occurrences are in
ReceivedInvoice.jsx,SentInvoice.jsxandBatchPayment.jsx, which open PRs (#227, #209, #207, #234) are editing. They'll move to this component in a follow-up once those merge, so this PR doesn't close the issue.Screenshots/Recordings:
NA added fallback if image fails to load
Additional Notes:
ImageWithFallback(src/components/ImageWithFallback.jsx) keeps the failure in React state instead of writing to the DOM: it triessrc, thenfallbackSrc, then renders thefallbacknode (or nothing). Each source is tried once, so a broken fallback image can no longer loop ononError, and the state resets whensrcchanges. Other props pass through to<img>.CountryPicker(2),InvoicePreview(logo + payment token),TokenCrousel,TokenPicker(viaAvatar).Avatarnow takesfallbackSrcinstead ofonError; if both the token image and the generic icon fail, it shows the token's initials.TokenPickeris its only consumer.npm run lint,npm run testandnpm run buildpass.AI Usage Disclosure:
Check one of the checkboxes below:
I have used the following AI models and tools: Claude Code (Claude Opus 5.5)
Checklist