mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-25 15:39:25 +00:00
parent
7f5b260681
commit
309c93e918
|
@ -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),
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue