From c943391e157ab3bab8bd4343874edb391205ed7d Mon Sep 17 00:00:00 2001 From: teidesu <86301490+teidesu@users.noreply.github.com> Date: Wed, 4 Aug 2021 13:16:08 +0300 Subject: [PATCH] fix(client): update local pts/qts before dispatching the update --- packages/client/src/methods/updates.ts | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/client/src/methods/updates.ts b/packages/client/src/methods/updates.ts index 864e9f2a..cb191b6d 100644 --- a/packages/client/src/methods/updates.ts +++ b/packages/client/src/methods/updates.ts @@ -692,6 +692,20 @@ async function _processSingleUpdate( ) } + // update local pts/qts + if (pts) { + if (channelId) { + this._cpts[channelId] = pts + this._cptsMod[channelId] = pts + } else { + this._pts = pts + } + } + + if (qts) { + this._qts = qts + } + if (isDummyUpdate(upd) || noDispatch) { // we needed to check pts/qts, so we couldn't return right away return @@ -735,20 +749,6 @@ async function _processSingleUpdate( this._dispatchUpdate(upd, peers.users, peers.chats) } - - // update local pts/qts - if (pts) { - if (channelId) { - this._cpts[channelId] = pts - this._cptsMod[channelId] = pts - } else { - this._pts = pts - } - } - - if (qts) { - this._qts = qts - } } /**