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 ?= new _collectionSingleton
|
||||||
_instance.load(args)
|
_instance.load(args)
|
||||||
|
|
||||||
@loadAssets: (args) ->
|
@loadAssets: (args, params) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _collectionSingleton
|
_instance ?= new _collectionSingleton
|
||||||
_instance.loadAssets(args)
|
_instance.loadAssets(args, params)
|
||||||
|
|
||||||
@reset: (args) ->
|
@reset: (args) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
|
@ -63,19 +63,25 @@ class _collectionSingleton extends Spine.Module
|
||||||
# reset in-memory
|
# reset in-memory
|
||||||
appObject.refresh(params.data, clear: true)
|
appObject.refresh(params.data, clear: true)
|
||||||
|
|
||||||
loadAssets: (assets) ->
|
loadAssets: (assets, params = {}) ->
|
||||||
return if _.isEmpty(assets)
|
return if _.isEmpty(assets)
|
||||||
|
|
||||||
# process not existing assets first / to avoid not exising ref errors
|
# process not existing assets first / to avoid not exising ref errors
|
||||||
loadAssetsLater = {}
|
loadAssetsLater = {}
|
||||||
for type, collections of assets
|
for type, collections of assets
|
||||||
later = @load(type: type, data: collections, later: true)
|
if !params.targetModel || params.targetModel isnt type
|
||||||
if !_.isEmpty(later)
|
later = @load(type: type, data: collections, later: true)
|
||||||
loadAssetsLater[type] = later
|
if !_.isEmpty(later)
|
||||||
|
loadAssetsLater[type] = later
|
||||||
|
|
||||||
# process existing assets
|
# process existing assets
|
||||||
for type, collections of loadAssetsLater
|
for type, collections of loadAssetsLater
|
||||||
App[type].refresh(collections)
|
App[type].refresh(collections)
|
||||||
|
|
||||||
|
if params.targetModel
|
||||||
|
for type, collections of assets
|
||||||
|
if params.targetModel is type
|
||||||
|
@load(type: type, data: collections)
|
||||||
|
|
||||||
load: (params) ->
|
load: (params) ->
|
||||||
|
|
||||||
|
|
|
@ -582,8 +582,8 @@ set new attributes of model (remove already available attributes)
|
||||||
callback(App[@className].all())
|
callback(App[@className].all())
|
||||||
App.QueueManager.add(queueManagerName, localCallback)
|
App.QueueManager.add(queueManagerName, localCallback)
|
||||||
|
|
||||||
return if @fetchFullActive is true
|
return if @fetchFullActive && @fetchFullActive > new Date().getTime() - 500
|
||||||
@fetchFullActive = true
|
@fetchFullActive = new Date().getTime()
|
||||||
App.Ajax.request(
|
App.Ajax.request(
|
||||||
type: 'GET'
|
type: 'GET'
|
||||||
url: url
|
url: url
|
||||||
|
@ -599,7 +599,7 @@ set new attributes of model (remove already available attributes)
|
||||||
|
|
||||||
# full / load assets
|
# full / load assets
|
||||||
if data.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
|
# in case of no record_ids are there, no inital render is fired
|
||||||
if data.record_ids && _.isEmpty(data.record_ids)
|
if data.record_ids && _.isEmpty(data.record_ids)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<% if @attribute.multiple: %>
|
<% if @attribute.multiple: %>
|
||||||
<%- @tokens %>
|
<%- @tokens %>
|
||||||
<% end %>
|
<% 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 %>
|
<% if @attribute.disableCreateObject isnt true: %><%- @Icon('arrow-down', 'dropdown-arrow') %><% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1491,7 +1491,7 @@ wait untill text in selector disabppears
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
begin
|
begin
|
||||||
if instance.find_elements(css: '.js-notificationsContainer .js-item:first-child')[0]
|
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
|
sleep 0.1
|
||||||
click_element = instance.find_elements(css: '.js-notificationsContainer .js-item:first-child .js-remove')[0]
|
click_element = instance.find_elements(css: '.js-notificationsContainer .js-item:first-child .js-remove')[0]
|
||||||
click_element&.click
|
click_element&.click
|
||||||
|
|
Loading…
Reference in a new issue