Fix loading next items in empty media viewer
This commit is contained in:
parent
6b16337260
commit
ac8e36a20b
@ -245,6 +245,11 @@ export default class AppMediaViewerBase<
|
|||||||
|
|
||||||
// * constructing html end
|
// * constructing html end
|
||||||
|
|
||||||
|
this.listLoader.onLoadedMore = () => {
|
||||||
|
this.buttons.prev.classList.toggle('hide', !this.listLoader.previous.length);
|
||||||
|
this.buttons.next.classList.toggle('hide', !this.listLoader.next.length);
|
||||||
|
};
|
||||||
|
|
||||||
this.setNewMover();
|
this.setNewMover();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1173,9 +1178,11 @@ export default class AppMediaViewerBase<
|
|||||||
} */
|
} */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if(this.nextTargets.length < 10 && this.loadMore) {
|
if(this.listLoader.next.length < 10) {
|
||||||
this.loadMore();
|
setTimeout(() => {
|
||||||
} */
|
this.listLoader.load(true);
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
//if(prevTarget && (!prevTarget.parentElement || !this.isElementVisible(this.targetContainer, prevTarget))) prevTarget = null;
|
//if(prevTarget && (!prevTarget.parentElement || !this.isElementVisible(this.targetContainer, prevTarget))) prevTarget = null;
|
||||||
//if(nextTarget && (!nextTarget.parentElement || !this.isElementVisible(this.targetContainer, nextTarget))) nextTarget = null;
|
//if(nextTarget && (!nextTarget.parentElement || !this.isElementVisible(this.targetContainer, nextTarget))) nextTarget = null;
|
||||||
|
@ -101,7 +101,7 @@ export async function openAvatarViewer(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(photo) {
|
if(photo) {
|
||||||
if(!isObject(message)) {
|
if(!isObject(message) && message) {
|
||||||
photo = appPhotosManager.getPhoto(message);
|
photo = appPhotosManager.getPhoto(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ export default class AvatarListLoader<Item extends {photoId: Photo.photo['id']}>
|
|||||||
loadMore: (anchor, older, loadCount) => {
|
loadMore: (anchor, older, loadCount) => {
|
||||||
if(this.peerId.isAnyChat() || !older) return Promise.resolve({count: 0, items: []}); // ! это значит, что открыло аватар чата, но следующих фотографий нет.
|
if(this.peerId.isAnyChat() || !older) return Promise.resolve({count: 0, items: []}); // ! это значит, что открыло аватар чата, но следующих фотографий нет.
|
||||||
|
|
||||||
const maxId = anchor?.photoId;
|
const maxId = anchor?.photoId || this.current?.photoId;
|
||||||
return appPhotosManager.getUserPhotos(this.peerId, maxId, loadCount).then(value => {
|
return appPhotosManager.getUserPhotos(this.peerId, maxId, loadCount).then(value => {
|
||||||
const items = value.photos.map(photoId => {
|
const items = value.photos.map(photoId => {
|
||||||
return {element: null as HTMLElement, photoId} as any;
|
return {element: null as HTMLElement, photoId} as any;
|
||||||
|
Loading…
Reference in New Issue
Block a user