manager: double check widget's existence before returning a list and prune (since linkId/id/address can change, removing the widgets can leave old routes leading nowhere)
This commit is contained in:
parent
7121c644db
commit
0fe1ce197f
1 changed files with 9 additions and 4 deletions
|
|
@ -113,15 +113,20 @@ WidgetManager.prototype.purge = function() {
|
|||
|
||||
WidgetManager.prototype.getWidgetBy = function(key, dict) {
|
||||
|
||||
var w = [],
|
||||
h1
|
||||
var widgets = [],
|
||||
h1, w
|
||||
|
||||
for (h2 in dict[key]) {
|
||||
h1 = dict[key][h2]
|
||||
w.push(this.widgets[[h1,h2].join('/')])
|
||||
w = this.widgets[[h1,h2].join('/')]
|
||||
if (!w) {
|
||||
delete dict[key][h2]
|
||||
} else {
|
||||
widgets.push(this.widgets[[h1,h2].join('/')])
|
||||
}
|
||||
}
|
||||
|
||||
return w
|
||||
return widgets
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue