You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
props.image && !imageFailed will be false as undefined is a falsy value. This way the onImageError function will never be called and it will never set imageFailed to true. However
this line explicitly checks for null which will not catch undefined and as I said earlier imageFailed will never be set to true. So at the end we will use p-avatar-image which will create a transparent background.
melloware
added
Type: Bug
Issue contains a defect related to a specific component.
and removed
Status: Needs Triage
Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
labels
Feb 14, 2023
melloware
added a commit
to melloware/primereact
that referenced
this issue
Feb 14, 2023
Describe the bug
Due to the changes in version 9.0.0 Avatar fallback is not working as intended because the wrong className is getting used.
I'm not sure what acutally changed between 8.7.3 and 9.0.0 but right now
primereact/components/lib/avatar/Avatar.js
Lines 12 to 13 in 595bcf3
props.image && !imageFailed
will befalse
asundefined
is a falsy value. This way theonImageError
function will never be called and it will never setimageFailed
totrue
. Howeverprimereact/components/lib/avatar/Avatar.js
Line 47 in 595bcf3
this line explicitly checks for
null
which will not catchundefined
and as I said earlierimageFailed
will never be set totrue
. So at the end we will usep-avatar-image
which will create a transparent background.Reproducer
CodeSandbox
PrimeReact version
9.0.0
React version
18.x
Language
TypeScript
Build / Runtime
Vite
Browser(s)
No response
Steps to reproduce the behavior
Expected behavior
Fallback icon Avatar should not have
p-avatar-image
in className and should not have transparent background.The text was updated successfully, but these errors were encountered: