Prevent observer from observing while loading posts

This commit is contained in:
Sonny Bakker 2023-08-12 21:00:37 +02:00
parent a4f5a7bdd7
commit 40a0b72d87
2 changed files with 1 additions and 4 deletions

View file

@ -34,9 +34,6 @@ class PostItem extends React.Component {
ruleUrl = `${this.props.feedUrl}/${rule.id}/`; ruleUrl = `${this.props.feedUrl}/${rule.id}/`;
} }
{
/* TODO: figure out why this is called up to three times */
}
return ( return (
<li className="posts__item" ref={this.props.forwardedRef}> <li className="posts__item" ref={this.props.forwardedRef}>
<h5 <h5

View file

@ -24,7 +24,7 @@ class PostList extends React.Component {
} }
componentDidUpdate() { componentDidUpdate() {
if (this.lastPostRef.current) { if (this.lastPostRef.current && !this.props.isFetching) {
this.observer.observe(this.lastPostRef.current); this.observer.observe(this.lastPostRef.current);
} }
} }