New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Base64 encoded images with 'fill' are always triggering 'missing sizes' warning #42006
Closed
1 task done
Labels
Image (next/image)
Related to Next.js Image Optimization.
Comments
teobler
added a commit
to teobler/next.js
that referenced
this issue
Oct 28, 2022
…s when using fill prop(vercel#42006).
teobler
added a commit
to teobler/next.js
that referenced
this issue
Oct 28, 2022
…s when using fill prop(vercel#42006).
teobler
added a commit
to teobler/next.js
that referenced
this issue
Oct 28, 2022
…s when using fill prop(vercel#42006).
4 tasks
teobler
added a commit
to teobler/next.js
that referenced
this issue
Oct 28, 2022
styfle
added
kind: bug
Image (next/image)
Related to Next.js Image Optimization.
and removed
bug
Issue was opened via the bug report template.
labels
Oct 28, 2022
Thanks for reporting this bug! It will be fixed in PR #42030 |
styfle
added a commit
that referenced
this issue
Oct 28, 2022
…' warning (#42030) fixes #42006 this issue occurred because images with `data url` src start with `blob` and `data` will be mark as `unoptimized`, then its `sizes` will be assigned with `undefined`. I just skip the check for `data url` images, if there is any better solution, we can have a discuss here. ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [x] Make sure the linting passes by running `pnpm build && pnpm lint` - [x] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md) Co-authored-by: Steven <steven@ceriously.com>
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Verify canary release
Provide environment information
What browser are you using? (if relevant)
irrelevant
How are you deploying your application? (if relevant)
irrelevant
Describe the Bug
When using the 'fill' prop in the Next.js image component on a Base64 encoded image, the following warning in the console from this code line will always be logged, even if there IS indeed a "sizes" prop:
According to this code line in the Next.js image component source code, the 'unoptimized' flag will be set on all Base64 encoded images. And because of this code line, all
sizes
attributes will be removed on unoptimized images. Thus, there is no way to avoid the triggering of the quoted console warning when using a Base64 encoded image with 'fill' – even if there is asizes
attribute given.Expected Behavior
The warning should not be triggered on Base64 encoded images with 'fill' and 'sizes' attributes.
Link to reproduction
https://stackblitz.com/edit/vercel-next-js-mjmfqs?file=pages/index.tsx
To Reproduce
Open reproduction example and check browser console messages. The printed warning message implies that no
sizes
prop is set, which is not true.The text was updated successfully, but these errors were encountered: