0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00

Updating the <Picture /> component to default to async image decoding (#3876)

* defaulting pictures to use decoding=async

* chore: add changeset
This commit is contained in:
Tony Sullivan 2022-07-09 18:44:31 +00:00 committed by GitHub
parent 1785e568a0
commit f961412862
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'@astrojs/image': patch
---
Bug: Updating the <Picture /> component to default to async image decoding

View file

@ -21,7 +21,7 @@ export interface RemoteImageProps extends Omit<PictureAttributes, 'src' | 'width
export type Props = LocalImageProps | RemoteImageProps; export type Props = LocalImageProps | RemoteImageProps;
const { src, sizes, widths, aspectRatio, formats = ['avif', 'webp'], loading = 'lazy', decoding = 'eager', ...attrs } = Astro.props as Props; const { src, sizes, widths, aspectRatio, formats = ['avif', 'webp'], loading = 'lazy', decoding = 'async', ...attrs } = Astro.props as Props;
const { image, sources } = await getPicture({ loader, src, widths, formats, aspectRatio }); const { image, sources } = await getPicture({ loader, src, widths, formats, aspectRatio });
--- ---