Ensure data is only loaded if not already loaded (needed to keep client/server state consistent)

This commit is contained in:
SteveSandersonMS
2016-02-09 23:06:30 -08:00
parent 3a567823e8
commit a84688d65c
9 changed files with 69 additions and 58 deletions

View File

@@ -6,18 +6,15 @@ import * as GenreList from '../../store/GenreList';
class Genres extends React.Component<GenresProps, void> {
componentWillMount() {
if (!this.props.genres.length) {
this.props.requestGenresList();
}
this.props.requestGenresList();
}
public render() {
let { genres } = this.props;
const { genres } = this.props;
return <div>
<h3>Browse Genres</h3>
<p>Select from { genres.length || '...' } genres:</p>
<p>Select from { this.props.isLoaded ? genres.length : '...' } genres:</p>
<ul className="list-group">
{genres.map(genre =>