Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Avatar images are loading again and again on each Application changeDetection #134

Closed
Vartld opened this issue Aug 23, 2019 · 3 comments
Closed

Comments

@Vartld
Copy link

Vartld commented Aug 23, 2019

Hi, first of all thank you for an amazing package!

We have faced the problem, while using your package in development of the chat feature for our application.

The problem is this:

We put a link for avatar image for each participant in chat adapter.
Then we payed attention, that on every Angular change detection, the avatar images are loaded again:
image

We checked the package code and found that
[src]="sanitizer.bypassSecurityTrustResourceUrl(user.avatar)"
[src]="sanitizer.bypassSecurityTrustResourceUrl(getChatWindowAvatar(window.participant, message))" in the \node_modules\ng-chat\fesm5 line 1525, are the strings, that are causing this problem.

To be more particular, it is sanitizer.bypassSecurityTrustResourceUrl function of the DomSanitizer.

We found out, if we allow Dom sanitation, by removing that function, everything works fine:
[src]="user.avatar"
[src]="getChatWindowAvatar(window.participant, message)"

Could you please deal with this issue, and let us know when it is solved.

Thank you, and best regards, AirsoftLtd development team.

@rpaschoal rpaschoal added the bug label Aug 23, 2019
@rpaschoal
Copy link
Owner

Hi @victorz-airsoft ,

This was added as a request by another user long time ago. I believe the sanitizer is helpful when the resources are coming from a different domain then the running application itself. I'll make this a configuration and leave it off by default which should fix your issue. I'm planning a patch release with small bug fixes soon so keep an eye on this.

Cheers

@Vartld
Copy link
Author

Vartld commented Aug 25, 2019 via email

@rpaschoal
Copy link
Owner

This should now be fixed with version 2.0.5: https://github.com/rpaschoal/ng-chat/releases/tag/2.0.5 👍

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

No branches or pull requests

2 participants