Removed race condition in App.Collection.loadAssets() - sometimes shown online notifications was without title.
This commit is contained in:
parent
434c154d57
commit
c300fdd4af
4 changed files with 20 additions and 14 deletions
|
@ -9,10 +9,10 @@ class App.Collection
|
|||
_instance ?= new _collectionSingleton
|
||||
_instance.load(args)
|
||||
|
||||
@loadAssets: (args) ->
|
||||
@loadAssets: (args, params) ->
|
||||
if _instance == undefined
|
||||
_instance ?= new _collectionSingleton
|
||||
_instance.loadAssets(args)
|
||||
_instance.loadAssets(args, params)
|
||||
|
||||
@reset: (args) ->
|
||||
if _instance == undefined
|
||||
|
@ -63,12 +63,13 @@ class _collectionSingleton extends Spine.Module
|
|||
# reset in-memory
|
||||
appObject.refresh(params.data, clear: true)
|
||||
|
||||
loadAssets: (assets) ->
|
||||
loadAssets: (assets, params = {}) ->
|
||||
return if _.isEmpty(assets)
|
||||
|
||||
# process not existing assets first / to avoid not exising ref errors
|
||||
loadAssetsLater = {}
|
||||
for type, collections of assets
|
||||
if !params.targetModel || params.targetModel isnt type
|
||||
later = @load(type: type, data: collections, later: true)
|
||||
if !_.isEmpty(later)
|
||||
loadAssetsLater[type] = later
|
||||
|
@ -77,6 +78,11 @@ class _collectionSingleton extends Spine.Module
|
|||
for type, collections of loadAssetsLater
|
||||
App[type].refresh(collections)
|
||||
|
||||
if params.targetModel
|
||||
for type, collections of assets
|
||||
if params.targetModel is type
|
||||
@load(type: type, data: collections)
|
||||
|
||||
load: (params) ->
|
||||
|
||||
# no data to load
|
||||
|
|
|
@ -582,8 +582,8 @@ set new attributes of model (remove already available attributes)
|
|||
callback(App[@className].all())
|
||||
App.QueueManager.add(queueManagerName, localCallback)
|
||||
|
||||
return if @fetchFullActive is true
|
||||
@fetchFullActive = true
|
||||
return if @fetchFullActive && @fetchFullActive > new Date().getTime() - 500
|
||||
@fetchFullActive = new Date().getTime()
|
||||
App.Ajax.request(
|
||||
type: 'GET'
|
||||
url: url
|
||||
|
@ -599,7 +599,7 @@ set new attributes of model (remove already available attributes)
|
|||
|
||||
# full / load assets
|
||||
if data.assets
|
||||
App.Collection.loadAssets(data.assets)
|
||||
App.Collection.loadAssets(data.assets, targetModel: @className)
|
||||
|
||||
# in case of no record_ids are there, no inital render is fired
|
||||
if data.record_ids && _.isEmpty(data.record_ids)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<% if @attribute.multiple: %>
|
||||
<%- @tokens %>
|
||||
<% end %>
|
||||
<input name="<%- @attribute.name %>_completion" class="user-select token-input js-objectSelect" autocapitalize="off" placeholder="<%- @attribute.placeholder %>" autocomplete="off" <%= @attribute.autofocus %> role="textbox" aria-autocomplete="list" value="<%= @name %>" aria-haspopup="true">
|
||||
<input name="<%- @attribute.name %>_completion" class="user-select token-input js-objectSelect" autocapitalize="off" placeholder="<%- @Ti(@attribute.placeholder) %>" autocomplete="off" <%= @attribute.autofocus %> role="textbox" aria-autocomplete="list" value="<%= @name %>" aria-haspopup="true">
|
||||
<% if @attribute.disableCreateObject isnt true: %><%- @Icon('arrow-down', 'dropdown-arrow') %><% end %>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1491,7 +1491,7 @@ wait untill text in selector disabppears
|
|||
sleep 0.5
|
||||
begin
|
||||
if instance.find_elements(css: '.js-notificationsContainer .js-item:first-child')[0]
|
||||
instance.mouse.move_to(instance.find_elements(css: '.js-notificationsContainer .js-item:first-child')[0])
|
||||
instance.action.move_to(instance.find_elements(css: '.js-notificationsContainer .js-item:first-child')[0])
|
||||
sleep 0.1
|
||||
click_element = instance.find_elements(css: '.js-notificationsContainer .js-item:first-child .js-remove')[0]
|
||||
click_element&.click
|
||||
|
|
Loading…
Reference in a new issue