Timeline: Mark messages read sooner, and a little more often
This commit is contained in:
parent
7821a872bd
commit
34a27accfc
1 changed files with 9 additions and 11 deletions
|
@ -541,17 +541,13 @@ export class Timeline extends React.Component<
|
|||
this.intersectionObserver.observe(atBottomDetectorEl);
|
||||
}
|
||||
|
||||
private markNewestBottomVisibleMessageRead = throttle(
|
||||
(): void => {
|
||||
const { markMessageRead } = this.props;
|
||||
const { newestBottomVisibleMessageId } = this.state;
|
||||
if (newestBottomVisibleMessageId) {
|
||||
markMessageRead(newestBottomVisibleMessageId);
|
||||
}
|
||||
},
|
||||
500,
|
||||
{ leading: false }
|
||||
);
|
||||
private markNewestBottomVisibleMessageRead = throttle((): void => {
|
||||
const { markMessageRead } = this.props;
|
||||
const { newestBottomVisibleMessageId } = this.state;
|
||||
if (newestBottomVisibleMessageId) {
|
||||
markMessageRead(newestBottomVisibleMessageId);
|
||||
}
|
||||
}, 500);
|
||||
|
||||
public override componentDidMount(): void {
|
||||
const containerEl = this.containerRef.current;
|
||||
|
@ -674,6 +670,8 @@ export class Timeline extends React.Component<
|
|||
numberToKeepAtBottom: this.maxVisibleRows,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.markNewestBottomVisibleMessageRead();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue