Fixed bug: New model record won't get refreshed in current function call as it should be if param 'later' is given.

This commit is contained in:
Thorsten Eckel 2018-06-22 14:54:51 +02:00
parent 4f6b0f7384
commit b4ffbc963c

View file

@ -110,19 +110,18 @@ class _collectionSingleton extends Spine.Module
# check if new object is newer, just load newer objects # check if new object is newer, just load newer objects
if object.updated_at if object.updated_at
currentUpdatedAt = appObject.updatedAt(key) currentUpdatedAt = appObject.updatedAt(key)
objectToLoad = undefined
if currentUpdatedAt if currentUpdatedAt
if currentUpdatedAt < object.updated_at if currentUpdatedAt < object.updated_at
objectToLoad = object if params.later
@log 'debug', 'refresh newer', params.type, key listToRefreshLater.push object
@log 'debug', 'refresh newer later', params.type, key
else
listToRefresh.push object
@log 'debug', 'refresh newer', params.type, key
else else
objectToLoad = object listToRefresh.push object
@log 'debug', 'refresh try no updated_at', params.type, key @log 'debug', 'refresh new no current updated_at', params.type, key
if objectToLoad
if params.later
listToRefreshLater.push objectToLoad
else
listToRefresh.push object
else else
listToRefresh.push object listToRefresh.push object
@log 'debug', 'refresh new', params.type, key @log 'debug', 'refresh new', params.type, key