Refresh home research feed: merge tools + serve retina-sharp images#1056
Merged
Conversation
The "Expert policy analysis" section was pulling only blog posts, but the team has been shipping interactive tools (CliffWatch, South Carolina 2026, Coverage Compass, etc.) faster than written posts. As a result the home preview was lagging by ~2 months on /us and missing recent UK tools on /uk. Switches HomeBlogPreview from getPostsSorted() to getResearchItems(), which merges posts + apps with displayWithResearch into one newest-first feed. Cards now route correctly per item type: posts continue to use Next.js Link to /<country>/research/<slug>, while apps (served via Vercel rewrites) use a plain <a> to /<countryId>/<slug> so the request hits the rewrite instead of a client-side 404. CTA flips to "Open" for apps and "Read more" for posts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
4 tasks
OptimisedImage hardcoded dpr = 1, so an image asked to fill a 640px slot was fetched at 640px and then upscaled by the browser to ~1280 physical pixels on every retina/high-DPI display — visibly soft across hero, team photos, blog/research cards, and tracker thumbnails. Switches to a 1x/2x srcset: the browser picks the right asset per device. Low-DPI screens keep using the 1x file (no bandwidth waste), high-DPI screens get the sharper 2x. When the snapped 1x and 2x widths collide (e.g. both round to the same ALLOWED_WIDTHS bucket) we drop the descriptor so the browser doesn't double-fetch the same file. Also factored out the bypass conditions into shouldSkipOptimisation() so the main render branch reads as straight srcset construction. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Right-column cards (SecondaryCard) were passing width=384 to OptimisedImage, but they actually render at the same ~600 CSS px as the left-column cards because the grid is two equal columns. At DPR=2 the browser needs ~1200 physical pixels of data; the 384-hint 2x snapped only to 828 → still upscaled → still soft on retina. Bumping to 640 matches the primary cards, snapping the 2x to 1920 — plenty sharp. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Two related fixes to the home page, bundled because both are about the "Expert policy analysis" section looking right.
1. Show newest research (posts + tools) instead of posts-only
/usand missed recent UK tools on/uk. The team is shipping interactive tools (CliffWatch, South Carolina 2026, Coverage Compass, West Virginia SB 392, Working Parents Tax Relief Act) faster than written posts.HomeBlogPreviewfromgetPostsSorted()togetResearchItems(), which merges posts + apps withdisplayWithResearch: trueinto one newest-first feed (same logic the/researchpage already uses).Linkto/<country>/research/<slug>; apps (served via Vercel rewrites) use a plain<a>to/<countryId>/<slug>so the request hits the rewrite instead of a client-side 404. CTA flips to "Open" for apps, "Read more" for posts.What changes for
/usBefore (Jan–Mar 2026): Keep Your Pay Act post, State income tax model, TANF modeling, SC H.3492 analysis, RI McKee CTC analysis.
After (Apr–May 2026): South Carolina 2026 calculator, Missouri tax elimination calculator, Coverage Compass, West Virginia SB 392 calculator, State EITCs and CTCs.
2. Serve 2× assets on retina displays via
srcsetOptimisedImagehardcodeddpr = 1, so a 640px-slot image was fetched at 640px of data and then upscaled by the browser to ~1280 physical pixels.srcsetso the browser picks the right asset per device. Low-DPI screens keep the 1x file (no bandwidth waste); high-DPI screens get the sharper 2x. When the snapped 1x and 2x widths land in the sameALLOWED_WIDTHSbucket, the descriptor is dropped to avoid double-fetching identical files./_next/*, dev mode, missing width) intoshouldSkipOptimisation()so the render branch reads as straightsrcsetconstruction.OptimisedImage: home, blog/research cards, team photos, events, citations, tracker preview.Test plan
/uson a retina display: 5 newest research items (mix of posts + tools) appear and render sharply/uk: UK-only items show, also sharp/<country>/research/<slug>&w=≈ 2× the rendered width on retinaw=is fetched instead🤖 Generated with Claude Code