]> Untitled Git - lemmy-ui.git/commitdiff
Fix admin default listing type. Fixes #797 (#818)
authorDessalines <dessalines@users.noreply.github.com>
Fri, 21 Oct 2022 19:27:59 +0000 (15:27 -0400)
committerGitHub <noreply@github.com>
Fri, 21 Oct 2022 19:27:59 +0000 (15:27 -0400)
src/shared/components/home/home.tsx
src/shared/utils.ts

index 21db06c400724770b52662f39f4ea9b7c6fdc1e8..6c2cc0a69e45b2f26738d2f0eee451ef0cdfc9a5 100644 (file)
@@ -210,9 +210,12 @@ export class Home extends Component<any, HomeState> {
     this.subscription.unsubscribe();
   }
 
-  static getDerivedStateFromProps(props: any): HomeProps {
+  static getDerivedStateFromProps(
+    props: HomeProps,
+    state: HomeState
+  ): HomeProps {
     return {
-      listingType: getListingTypeFromProps(props, ListingType.Local),
+      listingType: getListingTypeFromProps(props, state.listingType),
       dataType: getDataTypeFromProps(props),
       sort: getSortTypeFromProps(props),
       page: getPageFromProps(props),
index b65c425235171c0f2fb73ea340672823b8d009bd..afafdaa6846f767be1cd6ba43a7df7378bf369b7 100644 (file)
@@ -781,7 +781,6 @@ export function getListingTypeFromPropsNoDefault(props: any): ListingType {
     : ListingType.Local;
 }
 
-// TODO might need to add a user setting for this too
 export function getDataTypeFromProps(props: any): DataType {
   return props.match.params.data_type
     ? routeDataTypeToEnum(props.match.params.data_type)