Fix admin default listing type. Fixes #797 (#818)

This commit is contained in:
Dessalines 2022-10-21 15:27:59 -04:00 committed by GitHub
parent 7f5b260681
commit 309c93e918
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View 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),

View 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)