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

View File

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

View File

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