From 24d9c523c4ea4151432cb934efa5a21e9dfc488d Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 22 Sep 2014 19:36:18 +0200 Subject: [PATCH] Improved initFetch behaviour. --- .../javascripts/app/models/_application_model.js.coffee | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/app/models/_application_model.js.coffee b/app/assets/javascripts/app/models/_application_model.js.coffee index 64260358d..1b412bbe4 100644 --- a/app/assets/javascripts/app/models/_application_model.js.coffee +++ b/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