FIX: ensures last read is updated on exit (#26691)

This commit is contained in:
Joffrey JAFFEUX 2024-04-20 10:50:32 +02:00 committed by GitHub
parent a5ef7b1999
commit 08ff0bac29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 9 deletions

View File

@ -111,6 +111,7 @@ export default class ChatChannel extends Component {
this.#cancelHandlers();
removeOnPresenceChange(this.onPresenceChangeCallback);
this.subscriptionManager.teardown();
this.updateLastReadMessage();
}
@action
@ -415,15 +416,12 @@ export default class ChatChannel extends Component {
}
schedule("afterRender", () => {
let lastFullyVisibleMessageNode = null;
this.scrollable
.querySelectorAll(".chat-message-container")
.forEach((item) => {
if (checkMessageBottomVisibility(this.scrollable, item)) {
lastFullyVisibleMessageNode = item;
}
});
const messages = this.scrollable.querySelectorAll(
".chat-message-container"
);
let lastFullyVisibleMessageNode = Array.from(messages)
.reverse()
.find((item) => checkMessageBottomVisibility(this.scrollable, item));
if (!lastFullyVisibleMessageNode) {
return;