Skip to content

fix(icons): repair the attribute rewrite that stopped every icon rendering - #439

Merged
LeadcodeDev merged 1 commit into
mainfrom
fix/icon-attribute-rewrite
Sep 29, 2026
Merged

LeadcodeDev merged 1 commit into
mainfrom
fix/icon-attribute-rewrite

Conversation

@LeadcodeDev

Copy link
Copy Markdown
Owner

Closes #425.

set_root_attribute kept the closing quote of the value it replaced and appended
another. An Iconify source carrying width="1em" came out as width="84"", which
does not parse, so every icon has rendered nothing since #390 — announced only by
a warning on stderr under a zero exit code.

The existing tests missed it because they assert contains("width=\"84\""), which
is true of the broken string too. The new unit test parses the rewritten SVG with
usvg instead, and two render tests go through a real scenario to pixel assertions.
Reverting the one-character fix reports the icon painted 0 coloured pixels.

render --frame did not preload at all, so an unresolvable icon warned and exited
0 there while still, sheet and the encoders exited 1. It now goes through
preload_scenario_assets like the other single-frame paths — verified at 1 and 1.

674 files in a real cache still carry the old {slug}-{colour}-{w}x{h} name. They
are recoloured copies rather than sources, but the colour is in the filename, so
the substitution is reversible: on a source miss the cache is scanned for one and
currentColor is restored from it instead of refetching. That is what lets an
offline render work from a cache filled before the rework. Parsing is anchored at
the right of the name, since an icon's own name can contain a dash
(lucide_arrow-down-8b5cf6-176x176.svg).

The fourth item — reviving validate --offline / rustmotion icons prefetch — is
not here. #320 has since landed --allow-remote-fonts, so an offline render now
has a gate for fonts and none for icons, and the shape of the icon one should
follow that decision rather than precede it. Worth its own issue.

cargo fmt --all --check clean · cargo clippy --workspace --all-targets --features rustmotion/studio -D warnings clean · cargo test --workspace 1822 passed.

…ering

set_root_attribute kept the closing quote of the value it replaced and
appended another, so an Iconify source carrying width="1em" came out as
width="84"" and did not parse. Every icon has rendered nothing since
#390, announced only by a warning on stderr under a zero exit code.

The existing tests missed it because they assert contains("width=\"84\"")
on the output, which is true of the broken string too. The new unit test
parses the rewritten SVG with usvg instead, and the render tests go
through a real scenario to pixel assertions -- 0 coloured pixels on the
revert.

render --frame did not preload at all, so an unresolvable icon warned
and exited 0 there while still, sheet and the encoders exited 1. It now
goes through preload_scenario_assets like the other single-frame paths.

674 files in a real cache still carry the old {slug}-{colour}-{w}x{h}
name. They are recoloured copies, not sources, but the colour is in the
filename, so the substitution is reversible: on a source miss the cache
is scanned for one and currentColor is restored from it rather than
refetching. That is what lets an offline render work from a cache filled
before the rework. Parsing is anchored at the right of the name, since
an icon's own name can contain a dash.
@LeadcodeDev LeadcodeDev added the bug Something isn't working label Sep 29, 2026
@LeadcodeDev LeadcodeDev self-assigned this Sep 29, 2026
@LeadcodeDev
LeadcodeDev merged commit d9c3c57 into main Sep 29, 2026
4 checks passed
@LeadcodeDev
LeadcodeDev deleted the fix/icon-attribute-rewrite branch September 29, 2026 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: no icon renders since the icon cache rework (#365)

1 participant