Message List: Fix outgoing message sometimes not being scrolled to

This commit is contained in:
Alexander Zinchuk 2022-11-29 11:31:33 +01:00
parent b97114d6c8
commit 4d7db1afe2

View File

@ -77,6 +77,7 @@ export function init(_onUpdate: OnApiUpdate) {
export async function fetchMessages({ export async function fetchMessages({
chat, chat,
threadId, threadId,
offsetId,
...pagination ...pagination
}: { }: {
chat: ApiChat; chat: ApiChat;
@ -94,6 +95,10 @@ export async function fetchMessages({
...(threadId !== MAIN_THREAD_ID && { ...(threadId !== MAIN_THREAD_ID && {
msgId: threadId, msgId: threadId,
}), }),
...(offsetId && {
// Workaround for local message IDs overflowing some internal `Buffer` range check
offsetId: Math.min(offsetId, 2 ** (32 - 1) - 1),
}),
...pagination, ...pagination,
}), undefined, true); }), undefined, true);
} catch (err: any) { } catch (err: any) {
@ -1127,7 +1132,7 @@ export async function loadPollOptionResults({
export async function fetchExtendedMedia({ export async function fetchExtendedMedia({
chat, ids, chat, ids,
} : { }: {
chat: ApiChat; chat: ApiChat;
ids: number[]; ids: number[];
}) { }) {