Repository navigation
fix(image): the Image atom hides every image until hydration - #148
Conversation
`isLoading` started `true`, so every server-rendered `<Image>` and `<Avatar>` shipped its `<img>` at `opacity-0` and, for `<Image>`, behind an opaque placeholder. The image was invisible with JavaScript disabled, and Chromium does not treat a zero-opacity element as an LCP candidate, so no `<Image>` could be a page's LCP element. `isLoading` now starts `false`. The mount effect still only ever clears it: entering the loading state on mount would fade out an image the browser is already painting progressively from the server's markup. An in-place src change — the AudioPlayer thumbnail on a track switch — is what the placeholder was written for, and it still enters the state. The cost is the fade on a cold load, where the browser paints nothing for an unloaded `<img>` anyway. `Avatar` could then never enter the loading state at all, so its `isLoading`, its `onLoad` and its opacity transition are gone. The initials it already renders underneath are its placeholder. The placeholder's stacking question is moot — the server renders no placeholder when there is a src to show. For the record, `Placeholder` resolves to `position: relative`, not `absolute`: Tailwind v4.3.3 emits the position utilities alphabetically, so `.relative` wins. Co-authored-by: sydevs-bot <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QkK2Lpc3ZbdwaHNzvrwpPU
`<Image priority>` renders `loading="eager"` and `fetchPriority="high"`,
and React's Fizz renderer hoists a `<link rel="preload" as="image">` for
it. Both attributes sit before `{...props}`, so a caller passing
`loading` or `fetchPriority` directly still wins.
The preload comes from dropping `loading="lazy"`, not from
`fetchPriority`: Fizz hoists a preload for any `<img>` that is not lazy,
and `fetchPriority="high"` only promotes that link into the
high-priority set, capped at 10 per render. So `priority` has to flip
`loading`, and the default has to stay lazy — marking every image on a
page preloads every one of them and ranks none.
None of the thirteen callers passes it, so nothing changes for them.
Co-authored-by: sydevs-bot <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QkK2Lpc3ZbdwaHNzvrwpPU
React hoists a `<link rel="preload" as="image">` for any `<img>` that is not `loading="lazy"`, and `Avatar` set no `loading` at all. So every avatar on a page was preloaded, and with no `fetchPriority` they filled the high-priority preload set first-come — the slots an `<Image priority>` hero is meant to win. An avatar is never the hero. Confirmed against `origin/main`: the preload link is in the markup there too, so this removes a pre-existing cost rather than one just added. Co-authored-by: sydevs-bot <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QkK2Lpc3ZbdwaHNzvrwpPU
From the `/simplify` pass. The mount run of the `complete`/`naturalWidth` effect became a provable no-op once `isLoading` starts `false`, so it now returns early unless the state is actually set. That makes the effect's one live job — clearing the state after an in-place src change whose new src was already cached — what the code says, and drops a dead `imageSrcSet` dependency. The Fizz-preload explanation existed in three copies. The prop's JSDoc keeps it, and gains the hazard it creates: `priority` without an explicit `sizes` promotes the full-viewport-width fallback into a high-priority over-fetch. `DESIGN_SYSTEM.md` keeps the guidance and adds the rule the class of bug needs — a first render must produce visible markup. Specs: dropped a duplicate blank-src placeholder case and an assertion implied by the one beside it, and strengthened the existing blank-src spec to assert the gradient rather than a class the <img> also carries. Co-authored-by: sydevs-bot <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QkK2Lpc3ZbdwaHNzvrwpPU
From the `/code-review high` pass.
The story section titled "With Loading State" rendered three identical
loaded images, so it demonstrated nothing once the loading gate left the
first render. It now shows the three states that remain: loaded, absent
src with the placeholder holding the box, and `showLoading={false}`.
The `DESIGN_SYSTEM.md` rule said to "enter a loading state on the
client", which no component here implements and which reads as a
requirement to re-enter it on mount. It now says what `Image` does: the
loaded state is the first render, and a loading state is entered only
from a later change.
Co-authored-by: sydevs-bot <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QkK2Lpc3ZbdwaHNzvrwpPU
Deploying wemeditate-design with
|
| Latest commit: |
c8b50af
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://7332573d.wm-design.pages.dev |
| Branch Preview URL: | https://claude-fix-145-image-ssr-vis.wm-design.pages.dev |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wemeditate-web | c8b50af | Commit Preview URL Branch Preview URL |
Oct 01 2026, 07:57 PM |
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The defect fix is right and minimal. isLoading starting false makes the server <img> opaque in both layouts, and the effect's !isLoading guard keeps the src-swap path working. Filing #149 and #150 instead of widening the diff is right.
Phase 2 is the scope question. priority ships ahead of its first caller, this PR's own spec proves {...props} already emits the same markup, and one claim in its 21-line JSDoc is wrong.
Findings
should-fixImage.tsx:113—priorityhas no caller and no capability the spread lacks.should-fixImage.tsx:106— thesizesfallback claim is wrong twice.considerImage.tsx:351— a cold load now shows an empty box, not the skeleton.considerDESIGN_SYSTEM.md:288— the new bullet narrates #145.
What was checked
Ticket #145. git diff origin/main...6bfb872 — 6 files, +165/-48. Image.tsx and Avatar.tsx read whole. All 13 <Image> and 2 <Avatar> call sites grepped: none passes showLoading, two swap src in place. No contract surface in the diff.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
The note claimed a missing `sizes` falls back to full-viewport-width. It falls back to DEFAULT_SIZES, which is 100vw only under 640px, then 50vw, then 800px — and only when a srcSet exists, so a non-Cloudflare src gets no `sizes` at all. Name the case that over-fetches instead, and leave the mechanics to the `responsive` docs that already carry them. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01BMdouKahebk3rN5QJAww12
Ten lines carried two rules and re-told #145. The prop's own JSDoc already owns the preload mechanics, so the guidance points there instead of repeating them. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01BMdouKahebk3rN5QJAww12
|
Addressed the adversarial review in Adopted
Rebutted — your call
🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
The Image atom starts `isLoading` true and clears it from a client load handler, so its <img> renders `opacity-0` in SSR. Routing the mobile overlay hero through the atom therefore traded a wasted preload for an invisible hero — the exact property this branch refuses to impose on the atlas lead image, and the variant payoff that justified it stays inert until #141. `loading="lazy"` on the existing <img> closes the measured problem with no regression. Convert after #148 makes the atom's first render visible. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_0174NRurcaxgq55sz4UspoFw
One conflict, in the DESIGN_SYSTEM.md Performance list. Both sides added an above-the-fold image rule to the same bullet position. main (#148) fixed the Image atom's opacity-0-until-hydration gate and gave it a priority prop, so this branch's bullet cited a blocker that no longer exists. The second blocker still holds: the atom's container owns the layout and className reaches the image, and #145 deferred a fill mode, so a hero that must fill its parent still hand-rolls an img. The resolved bullet keeps that reason, main's `<Image priority sizes>` guidance and its one-or-two-per- page cap, and the never-a-CSS-background and `<picture>`-suppresses-the- preload rules. main's separate first-render-must-be-visible bullet is kept whole. Splash.tsx carried the same stale opacity-0 reason in a comment. git merged it clean because main never touched the file, so it is corrected here to the container-layout reason it now rests on. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DzGDzXPkGrSomd1FAi7Ern
Summary
<Image>and<Avatar>shipped its<img>atopacity-0, so images were invisible with JavaScript off and no<Image>could be a page's LCP element.srcchange enters it. The server renders an opaque<img>and no placeholder.<Image priority>rendersloading="eager"+fetchPriority="high"and gets a hoisted<link rel="preload" as="image">.Avatarnow setsloading="lazy", so avatars stop taking the preload slots apriorityhero needs.Changes
components/atoms/Image/Image.tsx—isLoadingstartsfalse; the mount effect only clears it;priorityprop.components/atoms/Avatar/Avatar.tsx— the opacity gate and its state are gone; the initials it already renders are its placeholder. Addsloading="lazy".DESIGN_SYSTEM.md— hero-image guidance, and the rule this bug broke.Preview
<Image>s, all nowopacity-100; the clearest place to toggle JavaScript offforceAspectRatio={false}layoutAll four verified 200 on the branch aliases.
Test results
tsc --noEmit,test:run— 79 files / 794 testsc8b50af), which changed only a JSDoc paragraph andDESIGN_SYSTEM.mdImage.test.tsx+Avatar.test.tsx, 8 of them new<img>on the home page carriesopacity-0, and every<Image>rendersopacity-100Manual verification
forceAspectRatio={false}.opacity-0, with the pattern scoped to the img tag — expect 0. The ticket wrote this criterion as a bare grep foropacity-0, which cannot reach 0: the home page has 13 hits, all from one unrelated carousel affordance (<div class="shrink-0 transition-opacity duration-200 opacity-0 pointer-events-none">).<Image priority>— needs a hero marked by hand first; see the first note below.Notes for reviewer
priorityhas no caller. The prop, its docs and its specs ship unused. Both of this site's real heroes bypass the atom —Splashpaints a CSSbackground-image, andAtlasContenthand-rolls an<img>— which fix(image): the Image atom hides every image until hydration #145 names as follow-on work. So the LCP win is unlocked here, not realized here.Splashis PR fix(image): the LCP hero is lazy-loaded and preload-invisible #144's file, so I left it alone.Image: a cold load now shows an empty container where it previously showed the animated gradient skeleton, because the server renders no placeholder and the container carries no background. Every caller that never swapssrcis affected, which is most of them. fix(image): the Image atom hides every image until hydration #145 preferred this over keeping the placeholder behind an opaque image, on the reasoning that an unloaded<img>paints nothing, so reserved width and height are enough. The lost skeleton is the cost, and switching to the ticket's second option is a product call I left to you.Avatar: with the gate gone and JS off, a 404'd photo now shows the browser's broken-image indicator over the initials, where before it was invisible. Nothing detects a broken image without JS. Net is strictly better — every avatar was invisible before, now only a broken one looks wrong — but it is a judgement call worth your eye.opacity-0— the same bug, one level up, and worse) and refactor(image): route hand-rolled <img> elements through the Image atom #150 (hand-rolled<img>s bypassing the atom, which the preview shows also double-fetches one photo perContentOverlay). fix(cards): index-grid cards ship at opacity-0, hiding title and text until hydration #149 is the one I would read first.Detail
Open question: is the
Placeholderpositioned at all? Settled. It emitsclass="relative overflow-hidden … absolute inset-0", and Tailwind v4.3.3 emits the position utilities alphabetically —.absolute,.fixed,.relative,.static,.sticky— so.relativeis generated last and wins. Compiled the real stylesheet to check rather than reasoning from class order.So the ticket's claim 2 was wrong. It predicted the placeholder "covers the image forever with JS off" in the
forceAspectRatio={false}layout. It does not: beingrelativeand in flow withheight: 100%against an auto-height parent, it collapses to zero height there. The image was hidden byopacity-0alone. Either way the question is now moot — the server renders no placeholder when there is a src.Open question: fill layout (acceptance criterion 6). Out of scope, recorded here as the criterion allows. The container's class list is owned by the atom and
classNamereaches the<img>, so a fill mode means a third layout mode besideforceAspectRatio— a real API cost with no caller in this ticket needing it.Why not re-enter the loading state on mount. My first version did, to keep the placeholder on client-side navigation. It is wrong: the browser is already painting the server's
<img>progressively, so entering the loading state on mount fades a partly-visible image out and back in. An unloaded<img>paints nothing anyway, so the placeholder buys nothing that reserved width and height do not. This is the option #145 preferred, and the fade on a cold load is the stated cost.Avatarlost its fade entirely, because onceisLoadingcannot become true the state, theonLoadand the transition are dead. Confirmed againstorigin/mainthat the avatar preload link pre-exists, soloading="lazy"removes a cost rather than one this PR added.The
priorityJSDoc'ssizesclaim was wrong, and is fixed inc8b50af. It said a missingsizesfalls back to full-viewport-width. It falls back toDEFAULT_SIZES(Image.tsx:16) —100vwonly under 640px, then50vw, then800px— and only when asrcSetexists (Image.tsx:362), so a non-Cloudflare src gets nosizesat all. The note now names the over-fetch case and defers the mechanics to theresponsiveprop's docs, which already carry them.Rejected review findings
priorityprop, since{...props}already emits identical markup. True, and fix(image): the Image atom hides every image until hydration #145 asked for it anyway: Phase 2 specifies the prop and acceptance criterion 3 requires its markup. Dropping it fails that criterion, so it is the reviewer's call.Imagenote above.isLoadingfromImageoutright. It still serves the AudioPlayer thumbnail's in-placesrcswap, which is deliberate, documented behaviour. Removing it is a UX decision beyond this ticket.key={imageSrc}. Genuinely better altitude, but a redesign of the atom's load lifecycle. Worth its own ticket.transition-opacity duration-300on the fade. It would break the fade: a transition animates only when the class is on the element in the end state too.priorityauthoritative over{...props}. Acceptance criterion 5 requires the spread to keep winning.boxed.onLoadto skip the listener. Micro, andhandleLoadmust still forward the caller'sonLoad.showLoadingis now a no-op on every first render. It is not —!hasSrcstill reaches it, which is the blank-src placeholder, and that path is specced.prioritystory. Apriorityimage looks identical in Ladle; the prop's effect is a<link>in the head. A story would document nothing.Fixture pre-mortem. The specs use no fixture. They render the real component through
renderToStaticMarkup, asdocs/rules/testing.mdprescribes, and assert on React's own output. Two spellings were verified against that output rather than assumed: React emitsfetchPrioritycamelCase, and with asrcSetthe hoisted link carriesimageSrcSet/imageSizesand nohref— so the assertions matchrelandasonly, and will survive #141.Review passes.
/simplify(4 agents) then/code-review high; thepr-review-toolkitplugin is not installed in a routine.comment-lintclean./security-reviewskipped — no path matchessecurityReview.triggerPattern. The adversarial review's four findings were addressed inc8b50afand its thread replies.Closes #145
🤖 Generated with Claude Code
https://claude.ai/code/session_01QkK2Lpc3ZbdwaHNzvrwpPU