Skip to content

Render Cloud Image editor preview through runtime CloudImage#190

Merged
lukebennett88 merged 1 commit into
mainfrom
refactor/cloud-image-shared-schema
Jun 15, 2026
Merged

Render Cloud Image editor preview through runtime CloudImage#190
lukebennett88 merged 1 commit into
mainfrom
refactor/cloud-image-shared-schema

Conversation

@lukebennett88

Copy link
Copy Markdown
Owner

Problem

"Cloud Image" had two rendering paths that drifted: the Keystatic editor component-block preview rendered a bespoke plain <img>, while production rendered through the CloudImage (@unpic/react) runtime component with the real sizing rules (MAX_WIDTH clamping, breakpoints, fit). The editor preview misrepresented what shipped.

Solution

The editor preview now renders through the same runtime CloudImage component, so what the author sees matches production. A small guard (URL.canParse(src)) falls back to a placeholder while the URL is still being typed, since CloudImage throws on an invalid URL. The field schema is unchanged — it remains the single source of the fields; only the second rendering path is removed.

The classic JSX pragma and explicit React import were dropped in favour of the project's default automatic runtime (consistent with the other renderer files).

Note: the preview-only "Priority image" figcaption is gone; the priority field's affordance is carried by its schema label/description, and in production it correctly drives eager loading.

Verification

  • pnpm --filter @lukebennett/web check — prettier, biome, tsc --noEmit clean.
  • pnpm --filter @lukebennett/web build — astro build completes.

Part of an architecture review pass; sibling PRs cover the AT Protocol module, manifest contract, and renderer registry.

The Keystatic editor preview rendered a bespoke plain <img> with its own
inline styles, while production rendered the unpic-transformed, clamped
image via CloudImage. Collapse to one rendering path so the preview
matches what ships. Guard the empty-URL case during editing since
CloudImage throws on an invalid URL.
@netlify

netlify Bot commented Jun 15, 2026

Copy link
Copy Markdown

Deploy Preview for lukebennett ready!

Name Link
🔨 Latest commit 5de9f4b
🔍 Latest deploy log https://app.netlify.com/projects/lukebennett/deploys/6a2fa2d7d2f8d40008906733
😎 Deploy Preview https://deploy-preview-190--lukebennett.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@lukebennett88 lukebennett88 merged commit d8a0107 into main Jun 15, 2026
5 checks passed
@lukebennett88 lukebennett88 deleted the refactor/cloud-image-shared-schema branch June 15, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant