Skip to content

Fix(Website): Check if "src" is undefined before images optimization #1047

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions website/components/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ const Image = forwardRef<HTMLImageElement, Props>((props, ref) => {
);
}

if (!props.src) {
console.error("Missing src. This image will NOT be rendered");
return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return null;
return <div data-identifier-error />;

}
Comment on lines +169 to +172
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should return some div to find the section with the error:

<div data-identifier-error />


const srcSet = getSrcSet(props.src, props.width, props.height, props.fit);
const linkProps = srcSet && {
imagesrcset: srcSet,
Expand Down
Loading