From: Dessalines Date: Thu, 2 May 2019 22:16:38 +0000 (-0700) Subject: Fix scrolling issue on refetch. X-Git-Url: http://these/git/%7B%60https:/%7B%60css/themes/%22https:/nerdica.net/%7BdocsUrl%7D?a=commitdiff_plain;h=9903e3d508537e6912e38f61739971af1949f25e;p=lemmy.git Fix scrolling issue on refetch. --- 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;