From 4b43cdf1431393f638642b33880577add5fd8ce0 Mon Sep 17 00:00:00 2001 From: Dessalines <tyhou13@gmx.com> Date: Mon, 8 Feb 2021 15:14:34 -0500 Subject: [PATCH] Fixing broken federated community paging. Fixes #166 --- src/shared/components/community.tsx | 7 ++++++- src/shared/routes.ts | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/shared/components/community.tsx b/src/shared/components/community.tsx index 2865a25..86ac243 100644 --- a/src/shared/components/community.tsx +++ b/src/shared/components/community.tsx @@ -405,8 +405,13 @@ export class Community extends Component<any, State> { const dataTypeStr = paramUpdates.dataType || DataType[this.state.dataType]; const sortStr = paramUpdates.sort || this.state.sort; const page = paramUpdates.page || this.state.page; + + let typeView = this.state.communityName + ? `/c/${this.state.communityName}` + : `/community/${this.state.communityId}`; + this.props.history.push( - `/c/${this.state.communityRes.community_view.community.name}/data_type/${dataTypeStr}/sort/${sortStr}/page/${page}` + `${typeView}/data_type/${dataTypeStr}/sort/${sortStr}/page/${page}` ); } diff --git a/src/shared/routes.ts b/src/shared/routes.ts index c059ad9..bef023e 100644 --- a/src/shared/routes.ts +++ b/src/shared/routes.ts @@ -73,7 +73,7 @@ export const routes: IRoutePropsWithFetch[] = [ fetchInitialData: req => Post.fetchInitialData(req), }, { - path: `/c/:name/data_type/:data_type/sort/:sort/page/:page`, + path: `/community/:id/data_type/:data_type/sort/:sort/page/:page`, component: Community, fetchInitialData: req => Community.fetchInitialData(req), }, @@ -82,6 +82,11 @@ export const routes: IRoutePropsWithFetch[] = [ component: Community, fetchInitialData: req => Community.fetchInitialData(req), }, + { + path: `/c/:name/data_type/:data_type/sort/:sort/page/:page`, + component: Community, + fetchInitialData: req => Community.fetchInitialData(req), + }, { path: `/c/:name`, component: Community, -- 2.44.1