Removing PropTypes; Adding scroll restoration, fixes #263

This commit is contained in:
James Barnsley
2019-02-10 19:51:33 +13:00
parent bcd11855f7
commit 4f27b0eb3e
85 changed files with 3622 additions and 2733 deletions

View File

@ -1,5 +1,5 @@
import React, { PropTypes } from 'react';
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import Link from '../../components/Link';
@ -30,6 +30,17 @@ class LibraryArtists extends React.Component{
}
}
componentWillMount(){
// Before we mount, restore any limit defined in our location state
var state = (this.props.location.state ? this.props.location.state : {});
if (state.limit){
this.setState({
limit: state.limit
});
}
}
componentDidMount(){
this.props.uiActions.setWindowTitle("Artists");
@ -93,7 +104,14 @@ class LibraryArtists extends React.Component{
}
loadMore(){
this.setState({limit: this.state.limit + this.state.per_page});
var new_limit = this.state.limit + this.state.per_page;
this.setState({limit: new_limit});
// Set our pagination to location state
var state = (this.props.location && this.props.location.state ? this.props.location.state : {});
state.limit = new_limit;
this.props.history.replace({state: state});
}
setSort(value){