Skip to content

Conversation

@JohnnyWyles
Copy link
Contributor

@JohnnyWyles JohnnyWyles commented Nov 7, 2025

What is the purpose of the change:

Asset logos not populating in the swap details
image

Also noticed this missing under the pools page "Total Balance" display when there are position owned by the connected wallet:
image

Linear Task

https://linear.app/osmosis/issue/FE-1542/in-and-out-token-logos-show-as-fallback-image-in-swap-widget

Brief Changelog

Adds a width to these logos
Prefers SVG which are more widely available in the chain registry.

Testing and Verifying

This change has been tested locally by rebuilding the website and verified content and links are expected

@vercel
Copy link

vercel bot commented Nov 7, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
osmosis-frontend Ready Ready Preview Comment Nov 19, 2025 2:00pm
4 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
osmosis-frontend-datadog Ignored Ignored Nov 19, 2025 2:00pm
osmosis-frontend-dev Ignored Ignored Nov 19, 2025 2:00pm
osmosis-frontend-edgenet Ignored Ignored Nov 19, 2025 2:00pm
osmosis-testnet Ignored Ignored Nov 19, 2025 2:00pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 7, 2025

Walkthrough

Image rendering was changed to prefer SVG assets: components now derive an SVG URL from existing PNG URLs and pass both svg and png fields to EntityImage, which now selects SVG first. One UI sizing class was also added for consistent image layout.

Changes

Cohort / File(s) Change Summary
Entity image selection logic
packages/web/components/ui/entity-image.tsx
Image URL selection order changed to prefer logoURIs.svg over logoURIs.png (uses `svg
Components providing svg/png URIs
packages/web/components/swap-tool/split-route.tsx, packages/web/components/cards/my-position/expanded.tsx, packages/web/components/pool-detail/concentrated.tsx
Each component now derives an svg URI by replacing a trailing .png with .svg from existing currency.coinImageUrl and supplies both svg and png to EntityImage. Public props unchanged.
UI sizing tweak
packages/web/components/swap-tool/split-route.tsx
Added fixed width class (w-7) alongside existing height class for DenomImage containers (h-7 w-7).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Areas to inspect closely:
    • entity-image.tsx — ensure fallback and error handling still correct when SVGs 404 or are unavailable.
    • All call sites adding svg field — confirm .replace(/\.png$/, '.svg') is appropriate for all provided URLs and won't produce incorrect URIs.
    • UI layout change in split-route.tsx — verify no visual regressions across breakpoints.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly relates to the main change: fixing symbol/logo display in the routing breakdown by preferring SVG assets and adding explicit width.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description check ✅ Passed The pull request description includes the required sections: purpose of change with supporting screenshot, linked Linear task, brief changelog, and testing verification.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jw/routesymbols

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/web/components/swap-tool/split-route.tsx (1)

237-254: The string replacement approach assumes consistent chain registry URL structure.

The implementation derives SVG URLs by replacing .png with .svg in currency.coinImageUrl. This approach works if the chain registry consistently places both formats at the same path with different extensions.

Potential considerations:

  1. Case sensitivity: The regex /\.png$/ won't match .PNG (uppercase)
  2. URL structure assumption: If some assets have PNGs but not SVGs at the derived path, this will generate 404 requests for non-existent SVGs
  3. Non-.png URLs: If coinImageUrl doesn't end with .png (e.g., already an SVG or different format), both svg and png properties will receive the same URL

The approach is safe due to optional chaining and EntityImage's fallback logic, but it relies on the chain registry's URL conventions being consistent.

If chain registry URL structure varies, consider checking response headers or using a more robust URL derivation method. Otherwise, the current approach is acceptable given the PR's assertion that "SVGs are more widely available in the chain registry."

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 20de2f3 and 49ac450.

📒 Files selected for processing (2)
  • packages/web/components/swap-tool/split-route.tsx (3 hunks)
  • packages/web/components/ui/entity-image.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-11-23T16:36:41.685Z
Learnt from: greg-nagy
Repo: osmosis-labs/osmosis-frontend PR: 3954
File: packages/web/components/alert/prettify.ts:43-44
Timestamp: 2024-11-23T16:36:41.685Z
Learning: In `packages/web/components/alert/prettify.ts`, when handling overspend error messages related to `uusdc`, assuming 6 decimal places is acceptable because `uusdc` uses 6 decimals.

Applied to files:

  • packages/web/components/swap-tool/split-route.tsx
🧬 Code graph analysis (1)
packages/web/components/swap-tool/split-route.tsx (1)
packages/web/components/ui/entity-image.tsx (1)
  • EntityImage (9-54)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Summary
🔇 Additional comments (2)
packages/web/components/swap-tool/split-route.tsx (1)

56-56: LGTM! Width fix addresses the display issue.

Adding explicit width (w-7) to match the height ensures the logo containers maintain proper dimensions and aspect ratio, which directly addresses the PR objective of fixing logos not showing in the routing breakdown.

Also applies to: 72-72

packages/web/components/ui/entity-image.tsx (1)

23-23: Ensure EntityImage retries PNG when an SVG load fails.

split-route.tsx creates an SVG path by replacing .png.svg and passes both svg & png to EntityImage, while the component currently selects the URL with logoURIs.svg || logoURIs.png (packages/web/components/ui/entity-image.tsx ~line 23). If the chosen SVG 404s, verify the component’s onError logic — it must try the PNG before falling back to the letter placeholder. Either implement a progressive fallback (SVG → PNG → letter) by tracking attempted sources in state and switching src onError, or confirm the chain-registry guarantees corresponding SVGs for every PNG at the expected path.

Files to check: packages/web/components/ui/entity-image.tsx (image selection and onError) and packages/web/components/swap-tool/split-route.tsx (svg construction).

Adds SVG support to asset images in Total Balance and position card components to match the fix applied to swap router logos, ensuring higher quality logo rendering.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
packages/web/components/pool-detail/concentrated.tsx (1)

553-560: Consider applying SVG preference consistently.

This EntityImage usage (lines 553-560) only provides a png URL without attempting SVG derivation, while other usages in this file (lines 503-506) and in expanded.tsx do derive SVG URLs.

Is there a reason this incentive image shouldn't also prefer SVG? If SVG assets are more widely available in the chain registry (per the PR description), it would be more consistent to apply the same SVG-first approach here.

If SVG preference should be applied here as well, consider:

                    <EntityImage
                      logoURIs={{
+                       ...(incentive.coinPerDay.currency.coinImageUrl?.toLowerCase().endsWith('.png') && {
+                         svg: incentive.coinPerDay.currency.coinImageUrl.replace(/\.png$/i, '.svg')
+                       }),
                        png: incentive.coinPerDay.currency.coinImageUrl,
                      }}
                      name={incentive.coinPerDay.currency.coinDenom}
                      symbol={incentive.coinPerDay.currency.coinDenom}
                      width={20}
                      height={20}
                    />

Or better yet, use the helper function suggested earlier.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 49ac450 and 235156b.

📒 Files selected for processing (2)
  • packages/web/components/cards/my-position/expanded.tsx (1 hunks)
  • packages/web/components/pool-detail/concentrated.tsx (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: test (22.x, web)
  • GitHub Check: test (22.x, bridge)
  • GitHub Check: test (22.x, stores)
  • GitHub Check: test (22.x, tx)
  • GitHub Check: test (22.x, bridge)
  • GitHub Check: test (22.x, web)
  • GitHub Check: wait-for-deployment
  • GitHub Check: Summary

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