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 = res.communities;
this.state.communities.sort((a, b) => b.number_of_subscribers - a.number_of_subscribers); this.state.communities.sort((a, b) => b.number_of_subscribers - a.number_of_subscribers);
this.state.loading = false; this.state.loading = false;
window.scrollTo(0,0);
this.setState(this.state); this.setState(this.state);
} else if (op == UserOperation.FollowCommunity) { } else if (op == UserOperation.FollowCommunity) {
let res: CommunityResponse = msg; let res: CommunityResponse = msg;

View File

@ -215,6 +215,7 @@ export class Community extends Component<any, State> {
let res: GetPostsResponse = msg; let res: GetPostsResponse = msg;
this.state.posts = res.posts; this.state.posts = res.posts;
this.state.loading = false; this.state.loading = false;
window.scrollTo(0,0);
this.setState(this.state); this.setState(this.state);
} else if (op == UserOperation.CreatePostLike) { } else if (op == UserOperation.CreatePostLike) {
let res: CreatePostLikeResponse = msg; let res: CreatePostLikeResponse = msg;

View File

@ -170,6 +170,7 @@ export class Inbox extends Component<any, InboxState> {
let res: GetRepliesResponse = msg; let res: GetRepliesResponse = msg;
this.state.replies = res.replies; this.state.replies = res.replies;
this.sendRepliesCount(); this.sendRepliesCount();
window.scrollTo(0,0);
this.setState(this.state); this.setState(this.state);
} else if (op == UserOperation.EditComment) { } else if (op == UserOperation.EditComment) {
let res: CommentResponse = msg; let res: CommentResponse = msg;

View File

@ -383,6 +383,7 @@ export class Main extends Component<any, MainState> {
let res: GetPostsResponse = msg; let res: GetPostsResponse = msg;
this.state.posts = res.posts; this.state.posts = res.posts;
this.state.loading = false; this.state.loading = false;
window.scrollTo(0,0);
this.setState(this.state); this.setState(this.state);
} else if (op == UserOperation.CreatePostLike) { } else if (op == UserOperation.CreatePostLike) {
let res: CreatePostLikeResponse = msg; let res: CreatePostLikeResponse = msg;

View File

@ -228,6 +228,7 @@ export class Modlog extends Component<any, ModlogState> {
} else if (op == UserOperation.GetModlog) { } else if (op == UserOperation.GetModlog) {
let res: GetModlogResponse = msg; let res: GetModlogResponse = msg;
this.state.loading = false; this.state.loading = false;
window.scrollTo(0,0);
this.setCombined(res); this.setCombined(res);
} }
} }

View File

@ -251,6 +251,7 @@ export class Search extends Component<any, SearchState> {
this.state.searchResponse = res; this.state.searchResponse = res;
this.state.loading = false; this.state.loading = false;
document.title = `Search - ${this.state.q} - Lemmy`; document.title = `Search - ${this.state.q} - Lemmy`;
window.scrollTo(0,0);
this.setState(this.state); this.setState(this.state);
} }

View File

@ -342,6 +342,7 @@ export class User extends Component<any, UserState> {
this.state.posts = res.posts; this.state.posts = res.posts;
this.state.loading = false; this.state.loading = false;
document.title = `/u/${this.state.user.name} - Lemmy`; document.title = `/u/${this.state.user.name} - Lemmy`;
window.scrollTo(0,0);
this.setState(this.state); this.setState(this.state);
} else if (op == UserOperation.EditComment) { } else if (op == UserOperation.EditComment) {
let res: CommentResponse = msg; let res: CommentResponse = msg;