Skip to content

fix(blog): preserve local feature_image when hydrating to broker stream#171

Merged
Jesssullivan merged 1 commit into
mainfrom
fix/blog-hydration-preserve-images
May 30, 2026
Merged

fix(blog): preserve local feature_image when hydrating to broker stream#171
Jesssullivan merged 1 commit into
mainfrom
fix/blog-hydration-preserve-images

Conversation

@Jesssullivan
Copy link
Copy Markdown
Owner

Symptom (TIN-1723)

On /blog, all posts show a featured image, then it reverts to only a few — a visible flicker on every page load.

Cause

The index renders displayPosts, which swaps from the SSR snapshot to the hub broker stream on onMount:

// before
displayPosts = brokerState.status === 'ready' ? brokerState.posts : data.posts
  • SSR (data.posts) comes from the spoke's search-index.json, ~135/137 posts imaged (the spoke derives feature_image from the first body image, else a deterministic slug-hash bird-photo backfill via scripts/add-feature-images.mts).
  • Broker stream (brokerState.posts) is derived hub-side from raw frontmatter only — no body scan, no backfill. Live stream right now: 137 posts, 7 with featureImage, 130 without.

So hydration kept the same post set but dropped ~128 card images. Pure client swap — caching only governs how long each side is visible.

Fix

Merge instead of replace: when a broker post has no feature_image, fall back to the local post's image by slug. Same posts, no image downgrade on hydration.

Verification

  • svelte-check: 1225 files, 0 errors in +page.svelte (the one repo-wide error is pre-existing in vite.config.ts:60, vite-8-beta typing, untouched here).
  • Single-file diff.

Follow-up

This stops the regression spoke-side. The durable fix — the hub broker projection deriving feature_image at parity with the spoke so the stream itself is ~135/137 imaged — is TIN-1723 (PR B, tinyland.dev).

The blog index swaps `displayPosts` from the SSR snapshot (`data.posts`,
~135/137 imaged via the spoke's body-image + slug-hash backfill) to the hub
broker stream on mount. The hub derives `feature_image` from raw frontmatter
only (no body scan, no backfill), so the live stream has just 7/137 imaged —
hydration was *dropping* card images that the local snapshot had (the visible
"all posts imaged, then revert to a few" regression).

Merge instead of replace: when a broker post lacks `feature_image`, fall back
to the local post's image by slug. Same post set, no image downgrade. The
durable fix (hub broker derives images at parity) is tracked in TIN-1723.
@Jesssullivan Jesssullivan merged commit 37b9b35 into main May 30, 2026
5 checks passed
@Jesssullivan Jesssullivan deleted the fix/blog-hydration-preserve-images branch May 30, 2026 13:26
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