SSR: no automatic image preloads for eager <img> elements (React emits <link rel="preload" as="image">)
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- react, typescript
- Ambito
- backend
Direzione di ricerca
Start by comparing Redact's server renderer with React's pushImg behavior in ReactFizzConfigDOM, then inspect how Redact collects head elements during rendering. Reproduce the issue with the provided renderToString example and check eager images with src, srcSet, loading="lazy", and fetchPriority. Done means matching React's image preload output and ordering; the linked open pull request #100 shows work is already underway.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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:
<meta charSet="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="preload" as="image" href="/favicon.svg"/>
<link rel="preload" as="image" imageSrcSet="/games/desk-crawler/screen-sample-800.png 800w, /games/desk-crawler/screen-sample.png 1200w" imageSizes="(min-width: 1024px) 560px, 100vw" fetchPriority="high"/>
<link rel="preload" as="image" href="/games/desk-crawler/icon-192.png"/>
<link rel="preload" as="image" href="/games/idle-angler/icon-192.png"/>
<link rel="stylesheet" href="/assets/styles-….css" data-precedence="default"/>
<title>…</title>
Redact:
<link rel="stylesheet" href="/assets/styles-….css" data-precedence="default"/>
<title>…</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
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.
Reproduction: a renderToString of
<html><head><link rel="stylesheet" href="/a.css" precedence="default" /><title>t</title><meta charSet="utf-8" /></head>
<body><img src="/hero.png" fetchPriority="high" alt="" /></body></html>
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.
- Lingua principale
- TypeScript
- Stelle
- 581
- Fork
- 28
- Merge medio
- 13h 48m
- PR unite (30g)
- 45
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di TanStack/redact
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
TanStack/redact#142 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 1-2 giorni Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 20/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di TanStack/redact
Issue simili
-
inference/go type/feature
Difficoltà 1/5 1-3 ore Idoneità per principianti 72/100
anomalyco/opencode#65148 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
truapi-release
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
paritytech/product-sdk#529 ·
I maintainer di solito rispondono entro 1 giorno
-
Add: Mansudae TVApertaapproved check:passed streams:add
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
I maintainer di solito rispondono entro 1 giorno
-
[Perf] Canvas layer composition is quadratic: splitRenderLayers re-copies the node array per nodeAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
devlikeapro/waha#2369 ·
I maintainer di solito rispondono entro 5 giorni