Merge branch 'next' into features

This commit is contained in:
aforge
2021-09-28 11:25:18 +03:00
13 changed files with 366 additions and 294 deletions
+6
View File
@@ -16,11 +16,17 @@ export default class LazyImage extends React.PureComponent {
}
componentDidMount() {
// whenDone is a wrapper around an actual promise to be able to cancel it.
this.props.whenDone
.promise
.then(data => this.setState({src: data.src, style: {...this.state.style, padding: 0}}))
.catch(() => this.setState({src: 'img/broken_image.png'}));
}
componentWillUnmount() {
this.props.whenDone.cancel();
}
componentDidUpdate(prevProps) {
if (prevProps.whenDone != this.props.whenDone) {
this.setState({src: 'img/placeholder.png', style: {...this.state.style, padding: '4px'}});