Timeline: Mark messages read sooner, and a little more often
Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
parent
a384d7bcdf
commit
71fb4eb4e3
|
@ -541,17 +541,13 @@ export class Timeline extends React.Component<
|
||||||
this.intersectionObserver.observe(atBottomDetectorEl);
|
this.intersectionObserver.observe(atBottomDetectorEl);
|
||||||
}
|
}
|
||||||
|
|
||||||
private markNewestBottomVisibleMessageRead = throttle(
|
private markNewestBottomVisibleMessageRead = throttle((): void => {
|
||||||
(): void => {
|
const { markMessageRead } = this.props;
|
||||||
const { markMessageRead } = this.props;
|
const { newestBottomVisibleMessageId } = this.state;
|
||||||
const { newestBottomVisibleMessageId } = this.state;
|
if (newestBottomVisibleMessageId) {
|
||||||
if (newestBottomVisibleMessageId) {
|
markMessageRead(newestBottomVisibleMessageId);
|
||||||
markMessageRead(newestBottomVisibleMessageId);
|
}
|
||||||
}
|
}, 500);
|
||||||
},
|
|
||||||
500,
|
|
||||||
{ leading: false }
|
|
||||||
);
|
|
||||||
|
|
||||||
public override componentDidMount(): void {
|
public override componentDidMount(): void {
|
||||||
const containerEl = this.containerRef.current;
|
const containerEl = this.containerRef.current;
|
||||||
|
@ -674,6 +670,8 @@ export class Timeline extends React.Component<
|
||||||
numberToKeepAtBottom: this.maxVisibleRows,
|
numberToKeepAtBottom: this.maxVisibleRows,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.markNewestBottomVisibleMessageRead();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue