diff --git a/web/client/components/background/BackgroundSelector.jsx b/web/client/components/background/BackgroundSelector.jsx index 5e0e35e9f1..65dc36a091 100644 --- a/web/client/components/background/BackgroundSelector.jsx +++ b/web/client/components/background/BackgroundSelector.jsx @@ -58,12 +58,6 @@ const BackgroundSelector = React.createClass({ this.props.onLayerChange('tempLayer', {}); this.props.onStartChange(0); }, - componentWillUpdate(nextProps) { - if (this.props.size.width !== nextProps.size.width - || this.props.size.height !== nextProps.size.height) { - this.props.onStartChange(0); - } - }, getThumb(layer) { return this.props.thumbs[layer.source] && this.props.thumbs[layer.source][layer.name] || layer.thumbURL || this.props.thumbs.unknown; }, diff --git a/web/client/components/background/PreviewList.jsx b/web/client/components/background/PreviewList.jsx index ba83444510..1a15c99dae 100644 --- a/web/client/components/background/PreviewList.jsx +++ b/web/client/components/background/PreviewList.jsx @@ -36,12 +36,12 @@ const PreviewList = React.createClass({ }, render() { let iconButtons = [].concat(this.props.icons); - iconButtons = iconButtons.slice(this.props.start, this.props.start + this.props.length); + iconButtons = this.props.pagination ? iconButtons.slice(this.props.start, this.props.start + this.props.length) : iconButtons; if (this.props.pagination) { if (this.props.start !== 0) { iconButtons.unshift( { this.props.onStartChange(this.props.start - 1); }} />); } - if (this.props.start + this.props.length !== this.props.icons.length) { + if (this.props.start + this.props.length < this.props.icons.length) { iconButtons.push( { this.props.onStartChange(this.props.start + 1); } } />); } } diff --git a/web/client/components/background/__tests__/BackgroundSelector-test.jsx b/web/client/components/background/__tests__/BackgroundSelector-test.jsx index fd4ad6b79c..8ef0ac0e97 100644 --- a/web/client/components/background/__tests__/BackgroundSelector-test.jsx +++ b/web/client/components/background/__tests__/BackgroundSelector-test.jsx @@ -69,11 +69,6 @@ describe("test the BackgroundSelector", () => { const node = ReactDOM.findDOMNode(backgroundSelector); expect(node).toExist(); - backgroundSelector.componentWillUpdate({size: {width: 1000, height: 400}, drawerEnabled: false}); - backgroundSelector.componentWillUpdate({size: {width: 900, height: 500}, drawerEnabled: false}); - backgroundSelector.componentWillUpdate({size: {width: 1000, height: 500}, drawerEnabled: true}); - backgroundSelector.componentWillUpdate({size: {width: 1000, height: 500}, drawerEnabled: false}); - const icons = backgroundSelector.getIcons(5, 5, 5, false); expect(icons.length).toBeGreaterThan(0);