diff --git a/src/components/Images.js b/src/components/Images.js index b9520f8..a87b34d 100644 --- a/src/components/Images.js +++ b/src/components/Images.js @@ -23,6 +23,9 @@ class Images extends Component { this.updatePics(); } } + componentWillUnmount() { + window.productImageUrl = null; + } updatePics = (newMainPic = this.state.mainPic) => { if (!window.tinyPicCache) window.tinyPicCache = {}; @@ -105,6 +108,8 @@ class Images extends Component { render() { // SPA version - full functionality with static fallback const getImageSrc = () => { + if(window.productImageUrl) return window.productImageUrl; + // If dynamic image is loaded, use it if (this.state.pics[this.state.mainPic]) { return this.state.pics[this.state.mainPic];