From b4ffbc963ca4328a90a56a10b59445432bfd7716 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Fri, 22 Jun 2018 14:54:51 +0200 Subject: [PATCH] Fixed bug: New model record won't get refreshed in current function call as it should be if param 'later' is given. --- .../app/lib/app_post/collection.coffee | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/app/lib/app_post/collection.coffee b/app/assets/javascripts/app/lib/app_post/collection.coffee index 815ba5734..189d94695 100644 --- a/app/assets/javascripts/app/lib/app_post/collection.coffee +++ b/app/assets/javascripts/app/lib/app_post/collection.coffee @@ -110,19 +110,18 @@ class _collectionSingleton extends Spine.Module # check if new object is newer, just load newer objects if object.updated_at currentUpdatedAt = appObject.updatedAt(key) - objectToLoad = undefined if currentUpdatedAt if currentUpdatedAt < object.updated_at - objectToLoad = object - @log 'debug', 'refresh newer', params.type, key + if params.later + listToRefreshLater.push object + @log 'debug', 'refresh newer later', params.type, key + else + listToRefresh.push object + @log 'debug', 'refresh newer', params.type, key + else - objectToLoad = object - @log 'debug', 'refresh try no updated_at', params.type, key - if objectToLoad - if params.later - listToRefreshLater.push objectToLoad - else - listToRefresh.push object + listToRefresh.push object + @log 'debug', 'refresh new no current updated_at', params.type, key else listToRefresh.push object @log 'debug', 'refresh new', params.type, key