Convert MyFilesPage._filesOwnershipLoaded to state var

This commit is contained in:
Alex Liebowitz 2016-09-24 02:50:13 -04:00
parent e5e27444a5
commit 9e3dc5b5ce

View file

@ -135,11 +135,11 @@ var MyFilesPage = React.createClass({
_fileTimeout: null, _fileTimeout: null,
_fileInfoCheckNum: 0, _fileInfoCheckNum: 0,
_filesOwnership: {}, _filesOwnership: {},
_filesOwnershipLoaded: false,
getInitialState: function() { getInitialState: function() {
return { return {
filesInfo: null, filesInfo: null,
filesOwnershipLoaded: false,
filesAvailable: {}, filesAvailable: {},
}; };
}, },
@ -170,13 +170,17 @@ var MyFilesPage = React.createClass({
this._filesOwnership[fileInfo.lbry_uri] = false; this._filesOwnership[fileInfo.lbry_uri] = false;
ownershipLoadedCount++; ownershipLoadedCount++;
if (ownershipLoadedCount >= filesInfo.length) { if (ownershipLoadedCount >= filesInfo.length) {
this._filesOwnershipLoaded = true; this.setState({
filesOwnershipLoaded: true,
});
} }
}, (err) => { }, (err) => {
this._filesOwnership[fileInfo.lbry_uri] = true; this._filesOwnership[fileInfo.lbry_uri] = true;
ownershipLoadedCount++; ownershipLoadedCount++;
if (ownershipLoadedCount >= filesInfo.length) { if (ownershipLoadedCount >= filesInfo.length) {
this._filesOwnershipLoaded = true; this.setState({
filesOwnershipLoaded: true,
});
} }
}); });
} }
@ -220,7 +224,7 @@ var MyFilesPage = React.createClass({
}); });
}, },
render: function() { render: function() {
if (this.state.filesInfo === null || !this._filesOwnershipLoaded) { if (this.state.filesInfo === null || !this.state.filesOwnershipLoaded) {
return ( return (
<main className="page"> <main className="page">
<BusyMessage message="Loading" /> <BusyMessage message="Loading" />