Allow passing newest read message explicitly
This commit is contained in:
parent
b30c53d291
commit
149b7d4f8b
1 changed files with 8 additions and 5 deletions
|
@ -452,7 +452,9 @@ export class Timeline extends React.Component<
|
|||
setIsNearBottom(id, newIsNearBottom);
|
||||
|
||||
if (newestBottomVisibleMessageId) {
|
||||
this.#markNewestBottomVisibleMessageRead();
|
||||
this.#markNewestBottomVisibleMessageRead(
|
||||
newestBottomVisibleMessageId
|
||||
);
|
||||
|
||||
const rowIndex = getRowIndexFromElement(newestBottomVisible);
|
||||
const maxRowIndex = items.length - 1;
|
||||
|
@ -506,11 +508,12 @@ export class Timeline extends React.Component<
|
|||
this.#intersectionObserver.observe(atBottomDetectorEl);
|
||||
}
|
||||
|
||||
#markNewestBottomVisibleMessageRead = throttle((): void => {
|
||||
#markNewestBottomVisibleMessageRead = throttle((messageId?: string): void => {
|
||||
const { id, markMessageRead } = this.props;
|
||||
const { newestBottomVisibleMessageId } = this.state;
|
||||
if (newestBottomVisibleMessageId) {
|
||||
markMessageRead(id, newestBottomVisibleMessageId);
|
||||
const messageIdToMarkRead =
|
||||
messageId ?? this.state.newestBottomVisibleMessageId;
|
||||
if (messageIdToMarkRead) {
|
||||
markMessageRead(id, messageIdToMarkRead);
|
||||
}
|
||||
}, 500);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue