fix(blog): preserve local feature_image when hydrating to broker stream#171
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 ononMount:data.posts) comes from the spoke'ssearch-index.json, ~135/137 posts imaged (the spoke derivesfeature_imagefrom the first body image, else a deterministic slug-hash bird-photo backfill viascripts/add-feature-images.mts).brokerState.posts) is derived hub-side from raw frontmatter only — no body scan, no backfill. Live stream right now: 137 posts, 7 withfeatureImage, 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 invite.config.ts:60, vite-8-beta typing, untouched here).Follow-up
This stops the regression spoke-side. The durable fix — the hub broker projection deriving
feature_imageat parity with the spoke so the stream itself is ~135/137 imaged — is TIN-1723 (PR B,tinyland.dev).