Fix scrolling issue on refetch.

This commit is contained in:
Dessalines 2019-05-02 15:16:38 -07:00
parent abe31e9f17
commit da1d7178a7
7 changed files with 7 additions and 0 deletions

View 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;

View 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;

View 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;

View 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;

View 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);
}
}

View 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);
}

View 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;