From 309c93e9188101666ddf2f2bd7e786e2efa2fd8b Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 21 Oct 2022 15:27:59 -0400 Subject: [PATCH] Fix admin default listing type. Fixes #797 (#818) --- src/shared/components/home/home.tsx | 7 +++++-- src/shared/utils.ts | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) 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) -- 2.44.1