Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Resolves issue with having invalid tour params. Utilize lodashGet to ensure tour is not undefined.

Stephan Wlodarczyk1c80b30475be
diff --git a/web/js/main.js b/web/js/main.js
index f96c17a37..60bfd011a 100644
--- a/web/js/main.js
+++ b/web/js/main.js
@@ -14,7 +14,7 @@ import {
listenForHistoryChange,
} from 'redux-location-state';
import { createBrowserHistory } from 'history';
-import { uniqBy } from 'lodash';
+import { uniqBy, get as lodashGet } from 'lodash';
import getMiddleware from './combine-middleware';
import { mapLocationToState, getParamObject } from './location';
import { stateToParams } from './redux-location-state-customs';
@@ -61,10 +61,12 @@ window.onload = () => {
promise
.done((config) => {
// Perform check to see if app was in the midst of a tour
- if (parameters.tr) {
- // Gets the extent of the first step of specified tour and overrides current view params
- parameters = util.fromQueryString(config.stories[parameters.tr].steps[0].stepLink);
+ const hasTour = lodashGet(config, `stories[${parameters.tr}]`);
+ if (hasTour) {
+ // Gets the extent of the first tour step and overrides view params
+ parameters = util.fromQueryString(hasTour.steps[0].stepLink);
}
+
config.pageLoadTime = parameters.now
? util.parseDateUTC(parameters.now) || new Date()
: new Date();