Fix avatar disappearing
This commit is contained in:
parent
d9a8da9382
commit
038a12931c
@ -114,6 +114,7 @@ export class AppAvatarsManager {
|
|||||||
img.classList.add('fade-in');
|
img.classList.add('fade-in');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let isFullLoaded = false;
|
||||||
if(size === 'photo_big') { // let's load small photo first
|
if(size === 'photo_big') { // let's load small photo first
|
||||||
const res = this.putAvatar(div, peerId, photo, 'photo_small');
|
const res = this.putAvatar(div, peerId, photo, 'photo_small');
|
||||||
renderThumbPromise = res.loadPromise;
|
renderThumbPromise = res.loadPromise;
|
||||||
@ -124,11 +125,17 @@ export class AppAvatarsManager {
|
|||||||
thumbImage.classList.add('avatar-photo', 'avatar-photo-thumbnail');
|
thumbImage.classList.add('avatar-photo', 'avatar-photo-thumbnail');
|
||||||
const url = appPhotosManager.getPreviewURLFromBytes(photo.stripped_thumb);
|
const url = appPhotosManager.getPreviewURLFromBytes(photo.stripped_thumb);
|
||||||
renderThumbPromise = renderImageFromUrlPromise(thumbImage, url).then(() => {
|
renderThumbPromise = renderImageFromUrlPromise(thumbImage, url).then(() => {
|
||||||
|
if(isFullLoaded) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
replaceContent(div, thumbImage);
|
replaceContent(div, thumbImage);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
callback = () => {
|
callback = () => {
|
||||||
|
isFullLoaded = true;
|
||||||
|
|
||||||
if(thumbImage) {
|
if(thumbImage) {
|
||||||
div.append(img);
|
div.append(img);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user