Skip to content

Commit

Permalink
Fix chaining of builder instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
weotch committed Aug 21, 2023
1 parent 19a3586 commit fbf6a85
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/sanity-next/src/lib/urlBuilding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ export function makeImageBuilder(source: SanityImageSource, {
}: imageUrlBuildingOptions = {}): ImageUrlBuilder {

// Open up builder
const builder = imageBuilder?.image(source).auto('format')
let builder = imageBuilder?.image(source).auto('format')

// Map the ObjectFit values to Sanity image CDN equivalents. The default
// is 'max'.
// https://www.sanity.io/docs/image-urls#fit-45b29dc6f09f
builder.fit(fit == ObjectFit.Cover ? 'min' : 'max')
builder = builder.fit(fit == ObjectFit.Cover ? 'min' : 'max')

// Conditionally add dimensions
if (width) builder.width(width)
if (height) builder.height(height)
if (width) builder = builder.width(width)
if (height) builder = builder.height(height)

// Return builder
return builder
Expand Down

0 comments on commit fbf6a85

Please sign in to comment.