refactor: import variant tier constants from shared module in loader#492
Merged
Conversation
#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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
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-onlyserver/lib/image-variants.ts).This switches
lib/image/loader.tsto importVARIANT_TIER_WIDTHS/buildVariantKey/VariantFormatfrom that module instead of its previously mirrored local copies — eliminating the dual source of truth.ceilToTier,hasReadyVariants,makeVariantLoader(loader-specific) stay inloader.ts.Verification
pnpm lint— 0 errors.npx tsc --noEmit— no errors inloader.tsor 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