From d539f03db39cfff526b53b0861df51a36df4b0b0 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 5 Sep 2016 12:00:35 +0200 Subject: [PATCH] Improved loadAssets, just execute if we have assets to load (ignore empty lists). --- app/assets/javascripts/app/lib/app_post/collection.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/app/lib/app_post/collection.coffee b/app/assets/javascripts/app/lib/app_post/collection.coffee index 08859832b..05b0b414d 100644 --- a/app/assets/javascripts/app/lib/app_post/collection.coffee +++ b/app/assets/javascripts/app/lib/app_post/collection.coffee @@ -64,13 +64,13 @@ class _collectionSingleton extends Spine.Module appObject.refresh(params.data, clear: true) loadAssets: (assets) -> - @log 'debug', 'loadAssets', assets + return if _.isEmpty(assets) # process not existing assets first / to avoid not exising ref errors - loadAssetsLater = [] + loadAssetsLater = {} for type, collections of assets later = @load(type: type, data: collections, later: true) - if later + if !_.isEmpty(later) loadAssetsLater[type] = later # process existing assets