diff --git a/light9/live/Light9AttrControl.ts b/light9/live/Light9AttrControl.ts --- a/light9/live/Light9AttrControl.ts +++ b/light9/live/Light9AttrControl.ts @@ -93,17 +93,31 @@ export class Light9AttrControl extends L private onValueProperty() { if (this.deviceAttrRow === null) throw new Error(); - if (this.effect !== null && this.graph !== undefined) { - const p = this.effect.edit(this.deviceAttrRow.device, this.deviceAttrRow.uri, this.value); - if (p.adds.length || p.dels.length) { - log("Effect told us to graph.patch", p, "to", this.graph); + if (!this.graph) { + log('ignoring value change- no graph yet') + return; + } + if (this.effect === null) { + this.value = null; + } else { + const p = this.effect.edit( + // + this.deviceAttrRow.device, + this.deviceAttrRow.uri, + this.value + ); + if (!p.isEmpty()) { + log("Effect told us to graph.patch this:\n", p.dump()); this.graph.applyAndSendPatch(p); } } } private onEffectProperty() { - if (this.effect === null) throw new Error(); + if (this.effect === null) { + log('no effect obj yet') + return; + } // effect will read graph changes on its own, but emit an event when it does this.effect.settingsChanged.subscribe(() => { this.effectSettingsChanged();