summaryrefslogtreecommitdiffstats
path: root/ui/src/components/main.tsx
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2020-01-15 17:28:59 -0500
committerDessalines <tyhou13@gmx.com>2020-01-15 17:28:59 -0500
commit9845fda05c94b01f1b46ac1e1be87e899b3a24d3 (patch)
treed7a041b76708de035ed7cae9a954d17c7dfe23b8 /ui/src/components/main.tsx
parente636f3bca3a1a59634d01f394ccf647e02f09b5a (diff)
Fix new post fetching. Fixes #422
Diffstat (limited to 'ui/src/components/main.tsx')
-rw-r--r--ui/src/components/main.tsx18
1 files changed, 9 insertions, 9 deletions
diff --git a/ui/src/components/main.tsx b/ui/src/components/main.tsx
index 373889f9..9e7d690d 100644
--- a/ui/src/components/main.tsx
+++ b/ui/src/components/main.tsx
@@ -112,14 +112,7 @@ export class Main extends Component<any, MainState> {
this.handleTypeChange = this.handleTypeChange.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),
@@ -429,7 +422,9 @@ export class Main extends Component<any, MainState> {
) : (
<div>
{this.selects()}
- <PostListings posts={this.state.posts} showCommunity />
+ {this.state.posts && (
+ <PostListings posts={this.state.posts} showCommunity />
+ )}
{this.paginator()}
</div>
)}
@@ -601,6 +596,11 @@ export class Main extends Component<any, MainState> {
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);