diff --git a/imports/startup/client/Gkeys.js b/imports/startup/client/Gkeys.js
index 7a3848e..aa9325e 100644
--- a/imports/startup/client/Gkeys.js
+++ b/imports/startup/client/Gkeys.js
@@ -6,6 +6,13 @@ import GoogleMapsLoader from 'google-maps';
class GkeysC {
constructor() {
this.gmapkey = new ReactiveVar(null);
+ // Separate from the key itself: a deployment with no gmaps key configured
+ // still loads the script and still has to render. Waiting on the key value
+ // meant that with an empty key every component mounted after the script had
+ // loaded (i.e. any client-side navigation) sat forever on "Waiting for the
+ // gkey" and rendered an empty
— /subscriptions/new was blank, with no
+ // error anywhere.
+ this.loaded = new ReactiveVar(false);
const self = this;
this.callbacks = [];
Meteor.startup(() => {
@@ -20,6 +27,7 @@ class GkeysC {
GoogleMapsLoader.createUrl = () => `${origCreateUrl()}&loading=async`;
GoogleMapsLoader.load(() => {
self.gmapkey.set(key);
+ self.loaded.set(true);
console.log('GMaps script just loaded');
self.doCallbacks(key);
});
@@ -37,14 +45,12 @@ class GkeysC {
load(callback) {
this.callbacks.push(callback);
Tracker.autorun((computation) => {
- const key = this.gmapkey.get();
- if (key) {
- // already loaded
- // console.log('GMaps already loaded');
- this.doCallbacks(key);
+ if (this.loaded.get()) {
+ // already loaded; the key may legitimately be empty
+ this.doCallbacks(this.gmapkey.get());
computation.stop();
} else {
- console.log('Waiting for the gkey');
+ console.log('Waiting for the gmaps script');
}
});
}