You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SSR: no automatic image preloads for eager <img> elements (React emits <link rel="preload" as="image">) #97
Version:@tanstack/redact 0.2.1 (same on 0.2.0), TanStack Start 1.168 on Cloudflare Workers, Vite plugin with ssr: { noExternal: true }. Baseline: react-dom 19.3.
React's streaming server renderer emits a <link rel="preload" as="image"> in <head> for images it renders eagerly: every <img> with a src or srcSet that is not loading="lazy", placed before the stylesheet when fetchPriority="high" and after it otherwise (pushImg in ReactFizzConfigDOM). Redact's server renderer emits none, so the browser only discovers the hero image once the parser reaches it in the body.
Same route rendered by both runtimes, head only. React:
The <img> elements themselves are rendered identically in both (srcset, sizes, fetchpriority="high" all present), and the font <link rel="preload"> elements rendered in the route's head come through fine. It is only the image preloads React synthesises from <img> that are missing.
A smaller related difference, visible above: React hoists <meta charset> and <meta name="viewport"> to the very start of <head>, ahead of stylesheets and the title. Redact keeps them in document order after the stylesheet and title. Here the charset lands at byte 219, inside the 1024-byte window, so it is harmless, but a page with a long stylesheet list or title could push it past the limit.
gives <meta charSet="utf-8"/><link rel="preload" as="image" href="/hero.png" fetchPriority="high"/><link rel="stylesheet" …/><title>t</title> on react-dom/server, and <link rel="stylesheet" …/><title>t</title><meta charset="utf-8"/> with no preload on @tanstack/redact/server.
Confirmed on 0.2.2 as well: the published package still emits no image preloads in either renderToString or renderToReadableStream, and keeps <meta charset> after the stylesheet and title. #100 implements both for document renders.
Activity
barrymichaeldoyle commentedon Oct 28, 2026
Confirmed on 0.2.2 as well: the published package still emits no image preloads in either
renderToStringorrenderToReadableStream, and keeps<meta charset>after the stylesheet and title. #100 implements both for document renders.