mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-26 06:11:15 +00:00
parent
7f5b260681
commit
309c93e918
2 changed files with 5 additions and 3 deletions
|
@ -210,9 +210,12 @@ export class Home extends Component<any, HomeState> {
|
||||||
this.subscription.unsubscribe();
|
this.subscription.unsubscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
static getDerivedStateFromProps(props: any): HomeProps {
|
static getDerivedStateFromProps(
|
||||||
|
props: HomeProps,
|
||||||
|
state: HomeState
|
||||||
|
): HomeProps {
|
||||||
return {
|
return {
|
||||||
listingType: getListingTypeFromProps(props, ListingType.Local),
|
listingType: getListingTypeFromProps(props, state.listingType),
|
||||||
dataType: getDataTypeFromProps(props),
|
dataType: getDataTypeFromProps(props),
|
||||||
sort: getSortTypeFromProps(props),
|
sort: getSortTypeFromProps(props),
|
||||||
page: getPageFromProps(props),
|
page: getPageFromProps(props),
|
||||||
|
|
|
@ -781,7 +781,6 @@ export function getListingTypeFromPropsNoDefault(props: any): ListingType {
|
||||||
: ListingType.Local;
|
: ListingType.Local;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO might need to add a user setting for this too
|
|
||||||
export function getDataTypeFromProps(props: any): DataType {
|
export function getDataTypeFromProps(props: any): DataType {
|
||||||
return props.match.params.data_type
|
return props.match.params.data_type
|
||||||
? routeDataTypeToEnum(props.match.params.data_type)
|
? routeDataTypeToEnum(props.match.params.data_type)
|
||||||
|
|
Loading…
Reference in a new issue