From 81a070b9ca00eb2d2722f128303d32d037e50dd4 Mon Sep 17 00:00:00 2001 From: "francois.grand" <francois.grand@irstea.fr> Date: Tue, 29 May 2018 16:05:27 +0200 Subject: [PATCH] =?UTF-8?q?Props.setProps()=20:=20correction=20d'un=20bug?= =?UTF-8?q?=20copiant=20incorrectement=20les=20propri=C3=A9t=C3=A9s=20memb?= =?UTF-8?q?res?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/session_nub.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/session_nub.ts b/src/session_nub.ts index fb9a96d3..781bd7ec 100644 --- a/src/session_nub.ts +++ b/src/session_nub.ts @@ -14,7 +14,7 @@ export class Props implements IObservable { public hasProperties(props: Props | {}): boolean { const keys = Object.keys(this._props); - const p = props instanceof Props ? props.props : props; + const p = props instanceof Props ? props._props : props; // if (keys.length != Object.keys(p).length) // return false; @@ -97,12 +97,15 @@ export class Props implements IObservable { */ public setProps(props: {}, sender?: any) { if (props instanceof Props) - var p = props.props; + var p = props._props; else p = props; const changed = this.compareObjects(this._props, p); if (changed) { - this._props = p; + this._props = {}; + for (const k in p) + this._props[k] = p[k]; + this.notifyPropsChange(sender); } } @@ -123,7 +126,7 @@ export class Props implements IObservable { for (const k in this._props) { if (res != "[") res += ", "; - res += `${k}:${this.props[k]}`; + res += `${k}:${this._props[k]}`; } res += "]" return res; -- GitLab