From 9903e3d508537e6912e38f61739971af1949f25e Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 2 May 2019 15:16:38 -0700 Subject: Fix scrolling issue on refetch. --- ui/src/components/communities.tsx | 1 + ui/src/components/community.tsx | 1 + ui/src/components/inbox.tsx | 1 + ui/src/components/main.tsx | 1 + ui/src/components/modlog.tsx | 1 + ui/src/components/search.tsx | 1 + ui/src/components/user.tsx | 1 + 7 files changed, 7 insertions(+) (limited to 'ui/src/components') diff --git a/ui/src/components/communities.tsx b/ui/src/components/communities.tsx index 190f8e3d..96864e9a 100644 --- a/ui/src/components/communities.tsx +++ b/ui/src/components/communities.tsx @@ -174,6 +174,7 @@ export class Communities extends Component { this.state.communities = res.communities; this.state.communities.sort((a, b) => b.number_of_subscribers - a.number_of_subscribers); this.state.loading = false; + window.scrollTo(0,0); this.setState(this.state); } else if (op == UserOperation.FollowCommunity) { let res: CommunityResponse = msg; diff --git a/ui/src/components/community.tsx b/ui/src/components/community.tsx index 93cdbd92..28841a2e 100644 --- a/ui/src/components/community.tsx +++ b/ui/src/components/community.tsx @@ -215,6 +215,7 @@ export class Community extends Component { let res: GetPostsResponse = msg; this.state.posts = res.posts; this.state.loading = false; + window.scrollTo(0,0); this.setState(this.state); } else if (op == UserOperation.CreatePostLike) { let res: CreatePostLikeResponse = msg; diff --git a/ui/src/components/inbox.tsx b/ui/src/components/inbox.tsx index 659a4a20..69ddc44b 100644 --- a/ui/src/components/inbox.tsx +++ b/ui/src/components/inbox.tsx @@ -170,6 +170,7 @@ export class Inbox extends Component { let res: GetRepliesResponse = msg; this.state.replies = res.replies; this.sendRepliesCount(); + window.scrollTo(0,0); this.setState(this.state); } else if (op == UserOperation.EditComment) { let res: CommentResponse = msg; diff --git a/ui/src/components/main.tsx b/ui/src/components/main.tsx index cd679ecb..1ec016ea 100644 --- a/ui/src/components/main.tsx +++ b/ui/src/components/main.tsx @@ -383,6 +383,7 @@ export class Main extends Component { let res: GetPostsResponse = msg; this.state.posts = res.posts; this.state.loading = false; + window.scrollTo(0,0); this.setState(this.state); } else if (op == UserOperation.CreatePostLike) { let res: CreatePostLikeResponse = msg; diff --git a/ui/src/components/modlog.tsx b/ui/src/components/modlog.tsx index 853bdd20..894887ae 100644 --- a/ui/src/components/modlog.tsx +++ b/ui/src/components/modlog.tsx @@ -228,6 +228,7 @@ export class Modlog extends Component { } else if (op == UserOperation.GetModlog) { let res: GetModlogResponse = msg; this.state.loading = false; + window.scrollTo(0,0); this.setCombined(res); } } diff --git a/ui/src/components/search.tsx b/ui/src/components/search.tsx index f066f6ed..7c72939a 100644 --- a/ui/src/components/search.tsx +++ b/ui/src/components/search.tsx @@ -251,6 +251,7 @@ export class Search extends Component { this.state.searchResponse = res; this.state.loading = false; document.title = `Search - ${this.state.q} - Lemmy`; + window.scrollTo(0,0); this.setState(this.state); } diff --git a/ui/src/components/user.tsx b/ui/src/components/user.tsx index 92ad5335..4cd88abc 100644 --- a/ui/src/components/user.tsx +++ b/ui/src/components/user.tsx @@ -342,6 +342,7 @@ export class User extends Component { this.state.posts = res.posts; this.state.loading = false; document.title = `/u/${this.state.user.name} - Lemmy`; + window.scrollTo(0,0); this.setState(this.state); } else if (op == UserOperation.EditComment) { let res: CommentResponse = msg; -- cgit v1.2.3