Preload tabs in shared media
Fix jumping empty context text in sidebar
This commit is contained in:
parent
904cecd370
commit
5e13c8bd91
@ -165,6 +165,9 @@ export default class Chat extends EventListenerBase<{
|
||||
|
||||
appSidebarRight.sharedMediaTab.setLoadMutex(this.setPeerPromise);
|
||||
appSidebarRight.sharedMediaTab.loadSidebarMedia(true);
|
||||
this.setPeerPromise.then(() => {
|
||||
appSidebarRight.sharedMediaTab.loadSidebarMedia(false);
|
||||
});
|
||||
|
||||
return this.setPeerPromise;
|
||||
}
|
||||
|
@ -314,6 +314,7 @@ export default class AppSharedMediaTab implements SliderTab {
|
||||
const scrollBarWidth = container.offsetWidth - container.clientWidth;
|
||||
container.style.overflowY = 'hidden';
|
||||
container.style.paddingRight = `${scrollBarWidth}px`;
|
||||
this.contentContainer.classList.add('sliding');
|
||||
}
|
||||
};
|
||||
|
||||
@ -322,6 +323,7 @@ export default class AppSharedMediaTab implements SliderTab {
|
||||
const container = this.scroll.container;
|
||||
container.style.overflowY = '';
|
||||
container.style.paddingRight = '0';
|
||||
this.contentContainer.classList.remove('sliding');
|
||||
};
|
||||
|
||||
public filterMessagesByType(ids: number[], type: SharedMediaType) {
|
||||
@ -688,7 +690,7 @@ export default class AppSharedMediaTab implements SliderTab {
|
||||
|
||||
const peerId = this.peerId;
|
||||
|
||||
let typesToLoad = single ? [this.sharedMediaType] : this.sharedMediaTypes;
|
||||
let typesToLoad = single ? [this.sharedMediaType] : this.sharedMediaTypes.filter(t => t !== this.sharedMediaType);
|
||||
typesToLoad = typesToLoad.filter(type => !this.loadedAllMedia[type]
|
||||
|| this.usedFromHistory[type] < this.historiesStorage[peerId][type].length);
|
||||
|
||||
@ -769,10 +771,13 @@ export default class AppSharedMediaTab implements SliderTab {
|
||||
this.loadSidebarMediaPromises[type].then(() => {
|
||||
setTimeout(() => {
|
||||
this.log('will preload more');
|
||||
this.loadSidebarMedia(true, true).then(() => {
|
||||
this.log('preloaded more');
|
||||
this.scroll.checkForTriggers();
|
||||
});
|
||||
const promise = this.loadSidebarMedia(true, true);
|
||||
if(promise) {
|
||||
promise.then(() => {
|
||||
this.log('preloaded more');
|
||||
this.scroll.checkForTriggers();
|
||||
});
|
||||
}
|
||||
}, 0);
|
||||
});
|
||||
}
|
||||
|
@ -400,6 +400,10 @@ export class AppImManager {
|
||||
appSidebarRight.sharedMediaTab.setPeer(this.chat.peerId);
|
||||
appSidebarRight.sharedMediaTab.loadSidebarMedia(true);
|
||||
appSidebarRight.sharedMediaTab.fillProfileElements();
|
||||
|
||||
setTimeout(() => {
|
||||
appSidebarRight.sharedMediaTab.loadSidebarMedia(false);
|
||||
});
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
|
@ -116,6 +116,10 @@
|
||||
min-height: calc((var(--vh, 1vh) * 100) - 100% - 60px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
&.sliding {
|
||||
max-height: calc((var(--vh, 1vh) * 100) - 100% - 60px);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user