linkId: fix multi linkId event chains; fix linkId sync not triggering prop updates
This commit is contained in:
parent
0b513aecee
commit
8d1794de76
2 changed files with 20 additions and 1 deletions
|
|
@ -1,5 +1,11 @@
|
|||
# Changelog
|
||||
|
||||
## 0.36.0
|
||||
|
||||
- bug fixes
|
||||
- `linkId` synchronizations now correctly trigger property updates
|
||||
- widgets with multiple `linkId` are now properly handled
|
||||
|
||||
## 0.35.0
|
||||
|
||||
- main
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ var WidgetManager = class WidgetManager extends EventEmitter {
|
|||
this.idRoute = {}
|
||||
this.linkIdRoute = {}
|
||||
|
||||
this.linkIdLock = []
|
||||
this.linkIdLockDepth = 0
|
||||
|
||||
this.scrollingWidgets = []
|
||||
|
||||
this.preArgsSeparator = '||||'
|
||||
|
|
@ -34,6 +37,9 @@ var WidgetManager = class WidgetManager extends EventEmitter {
|
|||
if (linkId) {
|
||||
if (!Array.isArray(linkId)) linkId = [linkId]
|
||||
linkId = linkId.map(x=>x.replace(/^>>\s*/, '')).filter(x=>x.indexOf('<<') < 0)
|
||||
linkId = linkId.filter(x=>this.linkIdLock.indexOf(x)<0)
|
||||
this.linkIdLock = this.linkIdLock.concat(linkId)
|
||||
this.linkIdLockDepth++
|
||||
}
|
||||
|
||||
var widgetsById = this.getWidgetById(id),
|
||||
|
|
@ -56,11 +62,18 @@ var WidgetManager = class WidgetManager extends EventEmitter {
|
|||
let v = widget.getValue()
|
||||
for (let i in widgetsByLinkId) {
|
||||
if (widgetsByLinkId[i] !== widget) {
|
||||
widgetsByLinkId[i].setValue(v,{send:options.send,sync:false})
|
||||
widgetsByLinkId[i].setValue(v,{send: options.send,sync: true})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (linkId && this.linkIdLockDepth) {
|
||||
this.linkIdLockDepth--
|
||||
if (!this.linkIdLockDepth) {
|
||||
this.linkIdLock = []
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
createAddressRef(widget, preArgs, address) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue