Skip to content
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

fix: adjust the apiLogoUrl logic to handles cases when icon is an object with uri key #7917

Merged
Merged
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: 3 additions & 2 deletions app/components/UI/WebsiteIcon/index.js
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@ class WebsiteIcon extends PureComponent {
/**
* Icon image to use, this substitutes getting the icon from the url
*/
icon: PropTypes.string,
icon: PropTypes.oneOfType([PropTypes.string | PropTypes.object]),
Copy link
Member

Choose a reason for hiding this comment

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

This is wrong, this is returning a number as a bitwise operation result.

Copy link
Member

Choose a reason for hiding this comment

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

The expected parameter is an array of PropTypes type properties

Suggested change
icon: PropTypes.oneOfType([PropTypes.string | PropTypes.object]),
icon: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),

Copy link
Member

Choose a reason for hiding this comment

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

fixed in #7953


/**
* Favicon source to use, this substitutes getting the icon from the url
@@ -98,8 +98,9 @@ class WebsiteIcon extends PureComponent {
// apiLogoUrl is the url of the icon to be rendered, but it's populated
// from the icon prop, if it exists, or from the faviconSource prop
// that is provided by the withFaviconAwareness HOC for useFavicon hook.

const apiLogoUrl = {
uri: icon || faviconSource,
uri: (typeof icon === 'string' ? icon : icon?.uri) || faviconSource,
};

let title = this.props.title;