widgets: fix widget register update from address 'auto' to something elese

This commit is contained in:
bordun 2020-06-12 15:20:23 +02:00
parent 3b0373f69d
commit 60ec29ecd7
2 changed files with 6 additions and 2 deletions

View file

@ -152,7 +152,7 @@ class WidgetManager extends EventEmitter {
newAddress = this.createAddressRef(widget),
hash = widget.hash
if (address && address !== 'auto' && this.addressRoute[address].indexOf(hash) != -1) this.addressRoute[address].splice(this.addressRoute[address].indexOf(hash), 1)
if (address && this.addressRoute[address].indexOf(hash) != -1) this.addressRoute[address].splice(this.addressRoute[address].indexOf(hash), 1)
if (!this.addressRoute[newAddress]) this.addressRoute[newAddress] = []
this.addressRoute[newAddress].push(hash)

View file

@ -840,9 +840,13 @@ class Widget extends EventEmitter {
var data = {},
oldData = {
preArgs: propName == 'preArgs' ? oldPropValue : this.getProp('preArgs'),
address: propName == 'address' ? oldPropValue : (this.getProp('address') === 'auto' ? '/' + this.getProp('id') : this.getProp('address'))
address: propName == 'address' ? oldPropValue : this.getProp('address')
}
data[propName] = this.getProp(propName)
if (data.address === 'auto') data.address = '/' + this.getProp('id')
if (oldData.address === 'auto') oldData.address = '/' + this.getProp('id')
widgetManager.registerWidget(this, data, oldData)
return