Fixed race condition in model setup

Change-Id: I698bd00567452a456108b0d65a83c0baa3284f59
diff --git a/src/app/datasources/helpers/model-discoverer.service.ts b/src/app/datasources/helpers/model-discoverer.service.ts
index 434f74e..b1382bd 100644
--- a/src/app/datasources/helpers/model-discoverer.service.ts
+++ b/src/app/datasources/helpers/model-discoverer.service.ts
@@ -220,16 +220,11 @@
   private cacheModelEntries(model: IXosModel): ng.IPromise<IXosModel> {
     const d = this.$q.defer();
 
-    let populated = false;
     const apiUrl = this.getApiUrlFromModel(model);
     this.XosModelStore.query(model.name, apiUrl)
       .subscribe(
         () => {
-          // skipping the first response as the observable gets created as an empty array
-          if (populated) {
-            return d.resolve(model);
-          }
-          populated = true;
+          return d.resolve(model);
         },
         err => {
           return d.reject(err);
diff --git a/src/app/datasources/stores/model.store.ts b/src/app/datasources/stores/model.store.ts
index 61eb114..345431b 100644
--- a/src/app/datasources/stores/model.store.ts
+++ b/src/app/datasources/stores/model.store.ts
@@ -23,6 +23,9 @@
   }
 
   public query(modelName: string, apiUrl: string): Observable<any> {
+    if (modelName === 'XOSGuiExtension') {
+      this.$log.log(performance.now(), `QUERY Model ${modelName}` );
+    }
     // if there isn't already an observable for that item
     // create a new one and .next() is called by this.loadInitialData once data are received
     if (!this._collections[modelName]) {
@@ -40,7 +43,7 @@
         (event: IWSEvent) => {
           this.storeHelpers.updateCollection(event, this._collections[modelName]);
         },
-        err => console.error
+        err => this.$log.error
       );
 
     return this._collections[modelName].asObservable();