Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

stop animtion on modal close #1755

Benjamin Kingf2af5de4bae2
diff --git a/web/js/components/animation-widget/play-queue.js b/web/js/components/animation-widget/play-queue.js
index e3f6aa51e..f2a76e9cf 100644
--- a/web/js/components/animation-widget/play-queue.js
+++ b/web/js/components/animation-widget/play-queue.js
@@ -29,7 +29,12 @@ class PlayAnimation extends React.Component {
this.checkQueue(props.queueLength, this.currentPlayingDate);
this.checkShouldPlay();
}
+ componentDidMount() {
+ this.mounted = true;
+ }
+
componentWillUnmount() {
+ this.mounted = false;
if (this.interval) {
clearInterval(this.interval);
}
@@ -453,7 +458,7 @@ class PlayAnimation extends React.Component {
return promiseImageryForTime(date, activeLayers);
})
.then(date => {
- if (this.props.isPlaying) {
+ if (this.mounted) {
this.preloadObject[strDate] = date;
delete this.inQueueObject[strDate];
this.shiftCache();
diff --git a/web/js/modules/animation/reducers.js b/web/js/modules/animation/reducers.js
index 2c3bc36e8..94486bcc7 100644
--- a/web/js/modules/animation/reducers.js
+++ b/web/js/modules/animation/reducers.js
@@ -37,7 +37,8 @@ export function animationReducer(state = defaultState, action) {
case EXIT_ANIMATION:
return lodashAssign({}, state, {
isActive: false,
- gifActive: false
+ gifActive: false,
+ isPlaying: false
});
case PLAY_ANIMATION:
return lodashAssign({}, state, {