Comments: Fix UI jumping in empty threads (#4088)
This commit is contained in:
parent
ee60271136
commit
9ef631665f
@ -186,6 +186,9 @@ addActionHandler('loadViewportMessages', (global, actions, payload): ActionRetur
|
||||
// Prevent requests with local offsets
|
||||
if (isLocalMessageId(offsetId)) return;
|
||||
|
||||
// Prevent unnecessary requests in threads
|
||||
if (offsetId === threadId && direction === LoadMoreDirection.Backwards) return;
|
||||
|
||||
const isOutlying = Boolean(listedIds && !listedIds.includes(offsetId));
|
||||
const historyIds = (isOutlying
|
||||
? selectOutlyingListByMessageId(global, chatId, threadId, offsetId) : listedIds)!;
|
||||
|
||||
@ -154,7 +154,8 @@ async function loadAndReplaceMessages<T extends GlobalState>(global: T, actions:
|
||||
.filter(Boolean)
|
||||
: [];
|
||||
|
||||
const isDiscussionStartLoaded = result.messages.some(({ id }) => id === resultDiscussion?.firstMessageId);
|
||||
const isDiscussionStartLoaded = !result.messages.length
|
||||
|| result.messages.some(({ id }) => id === resultDiscussion?.firstMessageId);
|
||||
const threadStartMessages = (isDiscussionStartLoaded && resultDiscussion?.topMessages) || [];
|
||||
const allMessages = threadStartMessages.concat(result.messages, localMessages);
|
||||
const allMessagesWithTopicLastMessages = allMessages.concat(topicLastMessages);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user