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);
}
componentWillMount () {
console.log('Preview will mount');
componentDidMount () {
this.previewFile(this.props.file);
}
componentWillReceiveProps (newProps) {
console.log('Preview will receive props', newProps);
if (newProps.file !== this.props.file) {
this.previewFile(newProps.file);
}

View file

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

View file

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

View file

@ -15,8 +15,7 @@ class ChannelSelect extends React.Component {
this.handleSelection = this.handleSelection.bind(this);
this.selectOption = this.selectOption.bind(this);
}
componentWillMount () {
console.log('ChannelSelector will mount');
componentDidMount () {
if (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.publish = this.publish.bind(this);
}
componentWillMount () {
componentDidMount () {
// check for whether a channel is already logged in
const loggedInChannelName = getCookie('channel_name');
const loggedInChannelShortId = getCookie('short_channel_id');

View file

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

View file

@ -21,7 +21,7 @@ module.exports = {
case 'image/gif':
if (file.size > 50000000) {
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;
case 'video/mp4':