Fix blinks on thread open, messages reading (#4743)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina 2024-02-22 07:40:14 +04:00 committed by GitHub
parent 9ccf593737
commit 44a6147368
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 8 deletions

View File

@ -145,7 +145,7 @@
{:else}
<div class="embeddedMarker" />
{/if}
<div class="flex-col ml-2 w-full clear-mins">
<div class="flex-col ml-2 w-full clear-mins message-content">
<div class="header clear-mins">
{#if person}
<EmployeePresenter value={person} shouldShowAvatar={false} />
@ -242,10 +242,6 @@
}
}
.content {
padding: 0;
}
&:hover > .actions {
visibility: visible;
}
@ -322,4 +318,10 @@
left: -0.5rem;
color: var(--white-color);
}
.message-content {
height: max-content;
flex-shrink: 1;
padding: 0;
}
</style>

View File

@ -97,6 +97,7 @@
function scrollToBottom (afterScrollFn?: () => void) {
if (scroller !== undefined && scrollElement !== undefined) {
scroller.scrollBy(scrollElement.scrollHeight)
updateSelectedDate()
afterScrollFn?.()
}
}
@ -208,7 +209,7 @@
let scrollToRestore = 0
function loadMore () {
if (!loadMoreAllowed || $isLoadingMoreStore || !scrollElement) {
if (!loadMoreAllowed || $isLoadingMoreStore || !scrollElement || isInitialScrolling) {
return
}
@ -293,7 +294,7 @@
void readChannelMessages(messagesToRead, notifyContext)
}
async function updateSelectedDate () {
function updateSelectedDate () {
if (!withDates) {
return
}
@ -351,8 +352,10 @@
isScrollInitialized = true
shouldWaitAndRead = true
autoscroll = true
shouldScrollToNew = true
waitLastMessageRenderAndRead(() => {
isInitialScrolling = false
autoscroll = false
})
} else if (separatorElement) {
isScrollInitialized = true
@ -399,6 +402,7 @@
}
scrollToLastMessage = true
scrollToBottom()
scrollUntilSeeLastMessage()
}
@ -439,6 +443,7 @@
await wait()
scrollToDate(dateToJump)
} else if (newCount > messagesCount) {
await wait()
scrollToNewMessages()
}

View File

@ -19,4 +19,4 @@
export let message: ActivityMessage
</script>
<ActivityMessagePresenter value={message} hideFooter hoverStyles="filledHover" withShowMore={false} />
<ActivityMessagePresenter value={message} hideFooter hoverStyles="filledHover" withShowMore={false} skipLabel />