Repository navigation
Decode SVG icon data urls in place instead of fetching them - #2411
Merged
Merged
Conversation
Every stored icon is a lucide reference or a data url, so the icon registry decodes SVG data urls synchronously and treats a failed resolution as final, dropping the fetch and the three-attempt retry cap. Closes #2354
kmcginnes
force-pushed
the
read-data-svg-icons-directly
branch
from
October 14, 2026 21:44
d75ed4d to
e316926
Compare
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
Every stored icon is a
lucide:reference or a base64data:url, so the icon registry no longer needs a fetch, a retry cap or per-icon failure counts to resolve an SVG icon. It now decodes the url in place, and SVG icons resolve synchronously like rasters.request(sources) raster resolve now svg - fetch(url) → text → sanitizeSvg, async - on failure: count, retry up to 3 times + atob + TextDecoder (UTF-8) → sanitizeSvg, resolve now + on failure: remember it, never retry lucide import() → markup, async (unchanged)DynamicIconand are unaffected.data:urls built by a newcreateSvgIconDataUrlhelper instead ofhttps://example.testurls behind a stubbedfetch.useResolvedIconsis unchanged: its effect still triggers the Lucideimport().Evidence
Before: SVG icons resolved after an async
fetchof their owndata:url, and the registry tests depended on a stubbedfetch.After: custom SVG icons render on the canvas with no fetch: one with non-ASCII text (airport), a width/height-only SVG with no
viewBox(continent), and a Lucide icon (country).Verified live: in Chrome against a Neptune air-routes database, I uploaded SVG icons with non-ASCII text, no
viewBox, and invalid markup, then checked the graph canvas, legend, search results, style dialog preview, and schema view, including after a reload that restored the session. Awindow.fetchwrapper recorded nodata:url fetches. The invalid icon showed no icon and logged one warning across repeated re-renders.Merge Danger
Door: two-way
Stored data and the icon value format are unchanged, so reverting restores the old resolution path.
Impact: icons
A Lucide icon whose chunk fails to load stays blank on the canvas until reload instead of retrying.
Related