diff --git a/src/lib/appManagers/appImManager.ts b/src/lib/appManagers/appImManager.ts index da834a41..890603ad 100644 --- a/src/lib/appManagers/appImManager.ts +++ b/src/lib/appManagers/appImManager.ts @@ -2796,7 +2796,7 @@ export class AppImManager { if(result instanceof Promise) { cached = false; promise = result.then((result) => { - this.log('getHistory not cached result by maxID:', maxID, reverse, isBackLimit, result, peerID); + this.log('getHistory not cached result by maxID:', maxID, reverse, isBackLimit, result, peerID, justLoad); if(justLoad) { this.scrollable.onScroll(); // нужно делать из-за ранней прогрузки @@ -2821,7 +2821,7 @@ export class AppImManager { return null; } else { cached = true; - this.log('getHistory cached result by maxID:', maxID, reverse, isBackLimit, result, peerID); + this.log('getHistory cached result by maxID:', maxID, reverse, isBackLimit, result, peerID, justLoad); promise = this.performHistoryResult(result.history || [], reverse, isBackLimit, additionMsgID); //return (reverse ? this.getHistoryTopPromise = promise : this.getHistoryBottomPromise = promise); //return this.performHistoryResult(result.history || [], reverse, isBackLimit, additionMsgID, true); diff --git a/src/lib/appManagers/appMessagesManager.ts b/src/lib/appManagers/appMessagesManager.ts index 33fea619..70b59156 100644 --- a/src/lib/appManagers/appMessagesManager.ts +++ b/src/lib/appManagers/appMessagesManager.ts @@ -4166,7 +4166,7 @@ export class AppMessagesManager { } } - var history = historyStorage.history.slice(offset, offset + limit); + let history = historyStorage.history.slice(backLimit ? Math.max(offset - backLimit, 0) : offset, offset + limit); if(!maxID && historyStorage.pending.length) { history = historyStorage.pending.slice().concat(history); }