Skip to content

fix: restore SVG renderability for content collection image() fields#15685

Merged
Princesseuh merged 1 commit intowithastro:mainfrom
jcayzac:fix/svg-components
Feb 27, 2026
Merged

fix: restore SVG renderability for content collection image() fields#15685
Princesseuh merged 1 commit intowithastro:mainfrom
jcayzac:fix/svg-components

Conversation

@jcayzac
Copy link
Copy Markdown
Contributor

@jcayzac jcayzac commented Feb 27, 2026

SVG images in content collection image() fields were regressed to plain metadata objects by 5bc2b2c, which fixed a TLA circular-dependency deadlock by skipping SVG component creation entirely.

Changes

The fix embeds the parsed SVG data (attributes and inner HTML) in the metadata at build time, then reconstructs the renderable component inside updateImageReferencesInData() in content/runtime.ts. This keeps the SVG Vite module free of server-runtime imports (preserving the TLA fix) while restoring the ability to render SVG images as inline components.

Testing

  • Existing tests pass
  • Add new test to validate the regression is fixed.

Docs

  • No impact on public API.

SVG images in content collection image() fields were regressed to plain
metadata objects by 5bc2b2c, which fixed a TLA circular-dependency
deadlock by skipping SVG component creation entirely.

The fix embeds the parsed SVG data (attributes and inner HTML) in the
metadata at build time, then reconstructs the renderable component inside
updateImageReferencesInData() in content/runtime.ts. This keeps the SVG
Vite module free of server-runtime imports (preserving the TLA fix) while
restoring the ability to render SVG images as inline components.
@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Feb 27, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 27, 2026

🦋 Changeset detected

Latest commit: 6f0e943

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Waiting for @Princesseuh 's approval

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Feb 27, 2026

Merging this PR will not alter performance

✅ 18 untouched benchmarks


Comparing jcayzac:fix/svg-components (6f0e943) with main (f47f5ae)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (2239cf2) during the generation of this report, so f47f5ae was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Copy link
Copy Markdown
Member

@Princesseuh Princesseuh left a comment

Choose a reason for hiding this comment

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

A bit hacky perhaps, but this seems fine to me?

@jcayzac
Copy link
Copy Markdown
Contributor Author

jcayzac commented Feb 27, 2026

Link to RCA for the original issue, at Erika's request: #15575 (comment)

@Princesseuh Princesseuh merged commit 1a323e5 into withastro:main Feb 27, 2026
26 checks passed
@jcayzac jcayzac deleted the fix/svg-components branch March 2, 2026 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants