From: Dessalines Date: Fri, 21 Oct 2022 19:27:59 +0000 (-0400) Subject: Fix admin default listing type. Fixes #797 (#818) X-Git-Url: http://these/git/%22https:/nerdica.net/%7B%24%7B%60data:application/manifest%20json;base64%2C%24%7Bawait?a=commitdiff_plain;h=309c93e9188101666ddf2f2bd7e786e2efa2fd8b;p=lemmy-ui.git Fix admin default listing type. Fixes #797 (#818) --- diff --git a/src/shared/components/home/home.tsx b/src/shared/components/home/home.tsx index 21db06c..6c2cc0a 100644 --- a/src/shared/components/home/home.tsx +++ b/src/shared/components/home/home.tsx @@ -210,9 +210,12 @@ export class Home extends Component { 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), diff --git a/src/shared/utils.ts b/src/shared/utils.ts index b65c425..afafdaa 100644 --- a/src/shared/utils.ts +++ b/src/shared/utils.ts @@ -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)