]> Untitled Git - lemmy-ui.git/commitdiff
Fixing broken federated community paging. Fixes #166
authorDessalines <tyhou13@gmx.com>
Mon, 8 Feb 2021 20:14:34 +0000 (15:14 -0500)
committerDessalines <tyhou13@gmx.com>
Mon, 8 Feb 2021 20:14:34 +0000 (15:14 -0500)
src/shared/components/community.tsx
src/shared/routes.ts

index 2865a25239958d06b95dec3ba41ed8c7fdd171fe..86ac243a475ebe2d9f27176e038173c57216d256 100644 (file)
@@ -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}`
     );
   }
 
index c059ad9d29d091de4106cfb06aa528b39c7a4815..bef023e2bd81f64e2fbe9c1c7d088ae504426d4a 100644 (file)
@@ -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,