]> Untitled Git - lemmy.git/commitdiff
Fix scrolling issue on refetch.
authorDessalines <tyhou13@gmx.com>
Thu, 2 May 2019 22:16:38 +0000 (15:16 -0700)
committerDessalines <tyhou13@gmx.com>
Thu, 2 May 2019 22:16:38 +0000 (15:16 -0700)
ui/src/components/communities.tsx
ui/src/components/community.tsx
ui/src/components/inbox.tsx
ui/src/components/main.tsx
ui/src/components/modlog.tsx
ui/src/components/search.tsx
ui/src/components/user.tsx

index 190f8e3d6ce614ce2203b69c1a8942cb088c3d4f..96864e9a584bdb96f4705fdd0b077faf8e313abc 100644 (file)
@@ -174,6 +174,7 @@ export class Communities extends Component<any, CommunitiesState> {
       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;
index 93cdbd92fc5e6149c33b9207b5f4ba15b65d232b..28841a2e5b3b0e0b45c3b7af9deaf7827f73c547 100644 (file)
@@ -215,6 +215,7 @@ export class Community extends Component<any, State> {
       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;
index 659a4a20d52ad11708e61643ee60c41015f8d79b..69ddc44b4beba8d9c3a6f183a9c111c76b11f259 100644 (file)
@@ -170,6 +170,7 @@ export class Inbox extends Component<any, InboxState> {
       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;
index cd679ecb9e92adde521415d6d5810a5f7ac382b7..1ec016ea67fae220e0915306cd488c6e9f8c8a6c 100644 (file)
@@ -383,6 +383,7 @@ export class Main extends Component<any, MainState> {
       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;
index 853bdd20415cf725bce4b2ec2b108b81eeba46e4..894887ae1b2dd95dcd644fbca757fd63ab0661a8 100644 (file)
@@ -228,6 +228,7 @@ export class Modlog extends Component<any, ModlogState> {
     } else if (op == UserOperation.GetModlog) {
       let res: GetModlogResponse = msg;
       this.state.loading = false;
+      window.scrollTo(0,0);
       this.setCombined(res);
     } 
   }
index f066f6ed63a376c392babe0bff7f422d2580343c..7c72939a7d147c8a85b98a417066a986c74c14b8 100644 (file)
@@ -251,6 +251,7 @@ export class Search extends Component<any, SearchState> {
       this.state.searchResponse = res;
       this.state.loading = false;
       document.title = `Search - ${this.state.q} - Lemmy`;
+      window.scrollTo(0,0);
       this.setState(this.state);
       
     }
index 92ad53359afe99582c457690df0b83d2eebe0b82..4cd88abc8ea2cd9c9940585165c5185c0a4c5614 100644 (file)
@@ -342,6 +342,7 @@ export class User extends Component<any, UserState> {
       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;