From 019b3b6da1dfb70c00e23f23c74e0b259e23801c Mon Sep 17 00:00:00 2001 From: Brandon Arp Date: Mon, 17 Dec 2018 21:36:42 -0800 Subject: [PATCH] fix initialization of metric name store --- dist/core/metric_names_store.js | 5 ++++- dist/core/metric_names_store.js.map | 2 +- dist/core/metric_names_store.ts | 4 +++- src/core/metric_names_store.ts | 4 +++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/dist/core/metric_names_store.js b/dist/core/metric_names_store.js index ee9a7a62..156c94fe 100644 --- a/dist/core/metric_names_store.js +++ b/dist/core/metric_names_store.js @@ -29,9 +29,12 @@ System.register(["lodash"], function (exports_1, context_1) { if (this.initialized) { return this.promiseUtils.resolvedPromise(this.metricNames); } - else { + else if (this.fetchingPromise !== undefined) { return this.fetchingPromise; } + else { + return this.initialize(); + } }; MetricNamesStore.prototype.cacheInitialized = function () { return !lodash_1.default.isUndefined(window[this.cacheKey]); diff --git a/dist/core/metric_names_store.js.map b/dist/core/metric_names_store.js.map index 3eca10d9..5db9c469 100644 --- a/dist/core/metric_names_store.js.map +++ b/dist/core/metric_names_store.js.map @@ -1 +1 @@ -{"version":3,"file":"metric_names_store.js","sourceRoot":"","sources":["metric_names_store.ts"],"names":[],"mappings":";;;;;;;;;;;YAIA;gBAQI,0BAAY,UAA8B,EAAE,YAA0B,EAAE,aAAqB;oBAPrF,gBAAW,GAAY,KAAK,CAAC;oBAQjC,IAAI,CAAC,QAAQ,GAAG,wBAAwB,GAAG,aAAa,CAAC;oBACzD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;oBACjC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;gBACjC,CAAC;gBAEM,qCAAU,GAAjB;oBACI,IAAI,IAAI,CAAC,gBAAgB,EAAE,EAAE;wBACzB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;wBACxB,OAAO,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;qBAC9D;yBAAM;wBACH,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;qBACvB;gBACL,CAAC;gBAEM,8BAAG,GAAV;oBACI,IAAI,IAAI,CAAC,WAAW,EAAE;wBAClB,OAAO,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;qBAC9D;yBAAM;wBACH,OAAO,IAAI,CAAC,eAAe,CAAC;qBAC/B;gBACL,CAAC;gBAEO,2CAAgB,GAAxB;oBACI,OAAO,CAAC,gBAAC,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACjD,CAAC;gBAEO,gCAAK,GAAb;oBAAA,iBAUC;oBATG,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE;yBAClD,IAAI,CAAC,UAAC,QAAQ,IAAK,OAAA,QAAQ,CAAC,IAAI,CAAC,OAAO,EAArB,CAAqB,CAAC;yBACzC,IAAI,CAAC,UAAC,WAAW;wBACd,KAAI,CAAC,WAAW,GAAG,WAAW,CAAC;wBAC/B,MAAM,CAAC,KAAI,CAAC,QAAQ,CAAC,GAAG,WAAW,CAAC;wBACpC,KAAI,CAAC,WAAW,GAAG,IAAI,CAAC;wBACxB,OAAO,KAAI,CAAC,WAAW,CAAC;oBAC5B,CAAC,CAAC,CAAC;oBACP,OAAO,IAAI,CAAC,eAAe,CAAC;gBAChC,CAAC;gBACL,uBAAC;YAAD,CAAC,AA9CD,IA8CC;;QACD,CAAC"} \ No newline at end of file +{"version":3,"file":"metric_names_store.js","sourceRoot":"","sources":["metric_names_store.ts"],"names":[],"mappings":";;;;;;;;;;;YAIA;gBAQI,0BAAY,UAA8B,EAAE,YAA0B,EAAE,aAAqB;oBAPrF,gBAAW,GAAY,KAAK,CAAC;oBAQjC,IAAI,CAAC,QAAQ,GAAG,wBAAwB,GAAG,aAAa,CAAC;oBACzD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;oBACjC,IAAI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,CAAC;gBACL,uBAAC;YAAD,CAAC,AAhDD,IAgDC;;QACD,CAAC"} \ No newline at end of file diff --git a/dist/core/metric_names_store.ts b/dist/core/metric_names_store.ts index 626f6d1b..86df3277 100644 --- a/dist/core/metric_names_store.ts +++ b/dist/core/metric_names_store.ts @@ -28,8 +28,10 @@ export class MetricNamesStore { public get(): Promise { if (this.initialized) { return this.promiseUtils.resolvedPromise(this.metricNames); - } else { + } else if (this.fetchingPromise !== undefined) { return this.fetchingPromise; + } else { + return this.initialize(); } } diff --git a/src/core/metric_names_store.ts b/src/core/metric_names_store.ts index 626f6d1b..86df3277 100644 --- a/src/core/metric_names_store.ts +++ b/src/core/metric_names_store.ts @@ -28,8 +28,10 @@ export class MetricNamesStore { public get(): Promise { if (this.initialized) { return this.promiseUtils.resolvedPromise(this.metricNames); - } else { + } else if (this.fetchingPromise !== undefined) { return this.fetchingPromise; + } else { + return this.initialize(); } }