Skip to content

refactor: import variant tier constants from shared module in loader#492

Merged
Zheaoli merged 1 commit into
mainfrom
refactor/loader-import-variant-tiers
May 30, 2026
Merged

refactor: import variant tier constants from shared module in loader#492
Zheaoli merged 1 commit into
mainfrom
refactor/loader-import-variant-tiers

Conversation

@Zheaoli

@Zheaoli Zheaoli commented May 30, 2026

Copy link
Copy Markdown
Collaborator

What

Follow-up to the FE-3 review note about mirrored constants. #479 extracted the client-safe tier ladder + key helpers into lib/image/variant-tiers.ts (single source of truth, also re-exported by the server-only server/lib/image-variants.ts).

This switches lib/image/loader.ts to import VARIANT_TIER_WIDTHS / buildVariantKey / VariantFormat from that module instead of its previously mirrored local copies — eliminating the dual source of truth. ceilToTier, hasReadyVariants, makeVariantLoader (loader-specific) stay in loader.ts.

Verification

  • pnpm lint — 0 errors.
  • npx tsc --noEmit — no errors in loader.ts or its consumers (masonry-photo-item / gallery-image / blur-image).

Net −6 lines; behavior identical (same tier values + key shape, now from the shared module).

🤖 Generated with Claude Code

#479 extracted the client-safe variant tier ladder and key helpers into
lib/image/variant-tiers.ts (the single source of truth, re-exported by the
server-only image-variants.ts). Switch the client loader to import
VARIANT_TIER_WIDTHS / buildVariantKey / VariantFormat from it instead of the
previously mirrored local copies, eliminating the dual source of truth flagged
in the FE-3 review.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented May 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
picimpact Ready Ready Preview, Comment May 30, 2026 2:14pm

@Zheaoli Zheaoli merged commit 416b2ec into main May 30, 2026
6 checks passed
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