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

Conversation

vitoUwu
Copy link
Contributor

@vitoUwu vitoUwu commented Mar 12, 2025

What is this Contribution About?

With this PR the Image component will no more break the entire section if src is not defined correctly.

I'm not happy yet on how we are handling it, now it only shows that are some Image somewhere in my codebase that will not be rendered and I have no clue on where it is. I've tried to use console.trace and console.error(new Error(...)) but the stack trace that I get is not enough to locate where this log is coming from.

tracing

Copy link
Contributor

Tagging Options

Should a new tag be published when this PR is merged?

  • 👍 for Patch 0.64.49 update
  • 🎉 for Minor 0.65.0 update
  • 🚀 for Major 1.0.0 update

Comment on lines +169 to +172
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.

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

<div data-identifier-error />

@@ -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 />;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants