Fix 'Comments' being loaded on Autoplay despite not visible.

This commit is contained in:
infiinte-persistence 2020-07-28 13:02:28 +08:00 committed by Sean Yesmunt
parent 0ab5ca080e
commit 93d26a0ebb
2 changed files with 10 additions and 1 deletions

View file

@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed
- Fix sluggish Back button when navigation back to channels with lots of comments _community pr!_ ([#4576](https://github.com/lbryio/lbry-desktop/pull/4576))
- Fix 'Related' and 'Comments' section lazy-load not working in some scenarios _community pr!_ ([#4586](https://github.com/lbryio/lbry-desktop/pull/4586))
## [0.47.1] - [2020-07-23]

View file

@ -36,6 +36,11 @@ type Props = {
};
class FilePage extends React.Component<Props> {
constructor() {
super();
this.lastReset = undefined;
}
componentDidMount() {
const { uri, fetchFileInfo, fetchCostInfo, setViewed, isSubscribed } = this.props;
@ -63,6 +68,7 @@ class FilePage extends React.Component<Props> {
if (prevProps.uri !== uri) {
setViewed(uri);
this.lastReset = Date.now();
}
// @if TARGET='app'
@ -136,6 +142,8 @@ class FilePage extends React.Component<Props> {
);
}
lastReset: ?any;
render() {
const { uri, renderMode, costInfo, obscureNsfw, isMature } = this.props;
@ -158,7 +166,7 @@ class FilePage extends React.Component<Props> {
actions={
<div>
<CommentCreate uri={uri} />
<WaitUntilOnPage>
<WaitUntilOnPage lastUpdateDate={this.lastReset}>
<CommentsList uri={uri} />
</WaitUntilOnPage>
</div>