changed componentwillmount to componentdidmount

This commit is contained in:
bill bittner 2018-01-18 10:13:51 -08:00
parent 3f0ac1f7f3
commit 1c52bcedc8
7 changed files with 8 additions and 11 deletions

View file

@ -10,12 +10,10 @@ class Preview extends React.Component {
}; };
this.previewFile = this.previewFile.bind(this); this.previewFile = this.previewFile.bind(this);
} }
componentWillMount () { componentDidMount () {
console.log('Preview will mount');
this.previewFile(this.props.file); this.previewFile(this.props.file);
} }
componentWillReceiveProps (newProps) { componentWillReceiveProps (newProps) {
console.log('Preview will receive props', newProps);
if (newProps.file !== this.props.file) { if (newProps.file !== this.props.file) {
this.previewFile(newProps.file); this.previewFile(newProps.file);
} }

View file

@ -21,7 +21,7 @@ class ProgressBar extends React.Component {
this.updateProgressBar = this.updateProgressBar.bind(this); this.updateProgressBar = this.updateProgressBar.bind(this);
this.stopProgressBar = this.stopProgressBar.bind(this); this.stopProgressBar = this.stopProgressBar.bind(this);
} }
componentWillMount () { componentDidMount () {
const bars = []; const bars = [];
for (let i = 0; i <= this.state.size; i++) { for (let i = 0; i <= this.state.size; i++) {
bars.push(<InactiveBar key={i} />); bars.push(<InactiveBar key={i} />);

View file

@ -16,8 +16,8 @@ function UrlMiddle ({publishInChannel, loggedInChannelName, loggedInChannelShort
UrlMiddle.propTypes = { UrlMiddle.propTypes = {
publishInChannel : PropTypes.bool.isRequired, publishInChannel : PropTypes.bool.isRequired,
loggedInChannelName : PropTypes.string.isRequired, loggedInChannelName : PropTypes.string,
loggedInChannelShortId: PropTypes.string.isRequired, loggedInChannelShortId: PropTypes.string,
}; };
export default UrlMiddle; export default UrlMiddle;

View file

@ -15,8 +15,7 @@ class ChannelSelect extends React.Component {
this.handleSelection = this.handleSelection.bind(this); this.handleSelection = this.handleSelection.bind(this);
this.selectOption = this.selectOption.bind(this); this.selectOption = this.selectOption.bind(this);
} }
componentWillMount () { componentDidMount () {
console.log('ChannelSelector will mount');
if (this.props.loggedInChannelName) { if (this.props.loggedInChannelName) {
this.selectOption(this.props.loggedInChannelName); this.selectOption(this.props.loggedInChannelName);
} }

View file

@ -15,7 +15,7 @@ class PublishForm extends React.Component {
this.makePublishRequest = this.makePublishRequest.bind(this); this.makePublishRequest = this.makePublishRequest.bind(this);
this.publish = this.publish.bind(this); this.publish = this.publish.bind(this);
} }
componentWillMount () { componentDidMount () {
// check for whether a channel is already logged in // check for whether a channel is already logged in
const loggedInChannelName = getCookie('channel_name'); const loggedInChannelName = getCookie('channel_name');
const loggedInChannelShortId = getCookie('short_channel_id'); const loggedInChannelShortId = getCookie('short_channel_id');

View file

@ -14,7 +14,7 @@ class PublishUrlInput extends React.Component {
this.setClaimNameFromFileName = this.setClaimNameFromFileName.bind(this); this.setClaimNameFromFileName = this.setClaimNameFromFileName.bind(this);
this.checkClaimIsAvailable = this.checkClaimIsAvailable.bind(this); this.checkClaimIsAvailable = this.checkClaimIsAvailable.bind(this);
} }
componentWillMount () { componentDidMount () {
if (!this.props.claim || this.props.claim === '') { if (!this.props.claim || this.props.claim === '') {
this.setClaimNameFromFileName(); this.setClaimNameFromFileName();
} }

View file

@ -21,7 +21,7 @@ module.exports = {
case 'image/gif': case 'image/gif':
if (file.size > 50000000) { if (file.size > 50000000) {
console.log('file was too big'); console.log('file was too big');
throw new Error('Sorry, .gifs are limited to 50 megabytes.'); throw new Error('Sorry, GIFs are limited to 50 megabytes.');
} }
break; break;
case 'video/mp4': case 'video/mp4':