diff options
author | Dessalines <tyhou13@gmx.com> | 2020-01-15 17:28:59 -0500 |
---|---|---|
committer | Dessalines <tyhou13@gmx.com> | 2020-01-15 17:28:59 -0500 |
commit | 9845fda05c94b01f1b46ac1e1be87e899b3a24d3 (patch) | |
tree | d7a041b76708de035ed7cae9a954d17c7dfe23b8 /ui/src/components/community.tsx | |
parent | e636f3bca3a1a59634d01f394ccf647e02f09b5a (diff) |
Fix new post fetching. Fixes #422
Diffstat (limited to 'ui/src/components/community.tsx')
-rw-r--r-- | ui/src/components/community.tsx | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/ui/src/components/community.tsx b/ui/src/components/community.tsx index 712aeb7e..6bcd88b1 100644 --- a/ui/src/components/community.tsx +++ b/ui/src/components/community.tsx @@ -89,14 +89,7 @@ export class Community extends Component<any, State> { this.handleSortChange = this.handleSortChange.bind(this); this.subscription = WebSocketService.Instance.subject - .pipe( - retryWhen(errors => - errors.pipe( - delay(3000), - take(10) - ) - ) - ) + .pipe(retryWhen(errors => errors.pipe(delay(3000), take(10)))) .subscribe( msg => this.parseMessage(msg), err => console.error(err), @@ -154,7 +147,7 @@ export class Community extends Component<any, State> { )} </h5> {this.selects()} - <PostListings posts={this.state.posts} /> + {this.state.posts && <PostListings posts={this.state.posts} />} {this.paginator()} </div> <div class="col-12 col-md-4"> @@ -285,6 +278,11 @@ export class Community extends Component<any, State> { this.setState(this.state); } else if (op == UserOperation.GetPosts) { let res: GetPostsResponse = msg; + + // This is needed to refresh the view + this.state.posts = undefined; + this.setState(this.state); + this.state.posts = res.posts; this.state.loading = false; this.setState(this.state); |