deep-chat icon indicating copy to clipboard operation
deep-chat copied to clipboard

Allow avatar img fallback

Open arielmoraes opened this issue 9 months ago • 2 comments

If the provided image is broken the avatar div shows the alt text (expected), this suggestion is to add a fallback in case of errors avoiding the following result:

Image

One solution is to add an error handler on the img element here: https://github.com/OvidijusParsiunas/deep-chat/blob/eb7df5c0eab8e97ea029541273c329e2c28046a6/component/src/views/chat/messages/avatar.ts#L34

If the provided image fails to load the default avatarUrl is then set.

arielmoraes avatar Feb 14 '25 12:02 arielmoraes

Hey @arielmoraes. That is an interesting feature. I will add it later this weekend as I am a little busy tomorrow. Thanks!

OvidijusParsiunas avatar Feb 14 '25 14:02 OvidijusParsiunas

Hey @arielmoraes.

I have added avatar fallback in deep-chat-dev and deep-chat-react-dev versions 9.0.230. These packages work exactly the same as the core ones except their names are different.

I will keep this issue open until this feature is merged into the core packages. Thanks!

OvidijusParsiunas avatar Feb 16 '25 11:02 OvidijusParsiunas

This is now available in deep-chat and deep-chat-react version 2.2.0.

OvidijusParsiunas avatar May 08 '25 13:05 OvidijusParsiunas