Browse Source

Improved initFetch behaviour.

Martin Edenhofer 10 years ago
parent
commit
24d9c523c4
1 changed files with 5 additions and 4 deletions
  1. 5 4
      app/assets/javascripts/app/models/_application_model.js.coffee

+ 5 - 4
app/assets/javascripts/app/models/_application_model.js.coffee

@@ -327,12 +327,13 @@ class App.Model extends Spine.Model
 
     # fetch init collection
     if param.initFetch is true
-      @one 'refresh', (collection) =>
-        @initFetchActive = false
-        callback(collection)
       if !@initFetchActive
-        @initFetchActive = true
+        @one 'refresh', (collection) =>
+          @initFetchActive = true
+          callback(collection)
         @fetch( {}, { clear: true } )
+      else
+        callback( @all() )
 
     # return key
     key