Skip to content

refactor: use actual svg in networks util package - #426

Merged
Julink-eth merged 1 commit into
mainfrom
refactor/asset-question-mark-svg
Oct 8, 2026
Merged

Julink-eth merged 1 commit into
mainfrom
refactor/asset-question-mark-svg

Conversation

@Julink-eth

Copy link
Copy Markdown
Contributor

Explanation

The shared Asset component's fallback icon was defined as an inline QUESTION_MARK_SVG string constant (600+ characters of SVG markup) in Asset.tsx, because at the time of #418 the library could not bundle .svg imports. #423 fixed that: the library now supports importing .svg files as strings, copies them to dist/, and ships a Jest transformer for them.
This PR switches the fallback to that mechanism:

  • Adds src/ui/Asset/question-mark.svg (the same question-mark markup as Stellar's src/ui/images/question-mark.svg), colocated with its only consumer.
  • Replaces the inline QUESTION_MARK_SVG export in Asset.tsx with import questionMarkIcon from './question-mark.svg', and uses it as the AssetIcon fallback.
  • Updates the fallback test to import the same file and assert its markup in the serialized output.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

@Julink-eth
Julink-eth requested a review from a team as a code owner October 8, 2026 12:10
@Julink-eth
Julink-eth deployed to default-branch October 8, 2026 12:10 — with GitHub Actions Active
@sonarqubecloud

sonarqubecloud Bot commented Oct 8, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused refactor preserves behavior and is covered by the existing fallback tests.

0 open findings

What changed in this PR

Replaces the shared AssetIcon fallback’s inline SVG constant with a bundled SVG asset.

Changes:

  • Adds the question-mark SVG asset.
  • Imports it as the fallback icon.
  • Updates fallback tests to use the SVG import.
File Description
packages/​snap-networks-utils/​src/​ui/​Asset/​question-mark.svg Adds the fallback icon asset.
packages/​snap-networks-utils/​src/​ui/​Asset/​Asset.tsx Uses the imported SVG as the fallback.
packages/​snap-networks-utils/​src/​ui/​Asset/​Asset.test.tsx Updates fallback assertions.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@Julink-eth
Julink-eth added this pull request to the merge queue Oct 8, 2026
Merged via the queue into main with commit 09d8030 Oct 8, 2026
62 of 63 checks passed
@Julink-eth
Julink-eth deleted the refactor/asset-question-mark-svg branch October 8, 2026 12:23

This branch was successfully deployed

1 active deployment
default-branch — 11fb7ea6 Deployed Oct 8, 2026 by Julink-eth via Determine whether this PR is a release PR #1555
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants