showTrendingMobile: boolean;
showSidebarMobile: boolean;
subscribedCollapsed: boolean;
+ scrolled: boolean;
tagline?: string;
siteRes: GetSiteResponse;
finished: Map<CommentId, boolean | undefined>;
postsRes: { state: "empty" },
commentsRes: { state: "empty" },
trendingCommunitiesRes: { state: "empty" },
+ scrolled: true,
siteRes: this.isoData.site_res,
showSubscribedMobile: false,
showTrendingMobile: false,
search: getQueryString(queryParams),
});
+ if (!this.state.scrolled) {
+ this.setState({ scrolled: true });
+ setTimeout(() => window.scrollTo(0, 0), 0);
+ }
+
await this.fetchData();
}
}
handlePageChange(page: number) {
+ this.setState({ scrolled: false });
this.updateUrl({ page });
- window.scrollTo(0, 0);
}
handleSortChange(val: SortType) {
+ this.setState({ scrolled: false });
this.updateUrl({ sort: val, page: 1 });
- window.scrollTo(0, 0);
}
handleListingTypeChange(val: ListingType) {
+ this.setState({ scrolled: false });
this.updateUrl({ listingType: val, page: 1 });
- window.scrollTo(0, 0);
}
handleDataTypeChange(val: DataType) {
+ this.setState({ scrolled: false });
this.updateUrl({ dataType: val, page: 1 });
- window.scrollTo(0, 0);
}
async handleAddModToCommunity(form: AddModToCommunity) {