From 714647c75fac409dc446f12ef341c2bdbbec38d6 Mon Sep 17 00:00:00 2001 From: Sebastien DUMETZ Date: Tue, 11 Jun 2024 11:49:28 +0200 Subject: [PATCH] fix reset of multi-value Properties --- source/Property.ts | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/source/Property.ts b/source/Property.ts index 5db1fa5..a7cb977 100644 --- a/source/Property.ts +++ b/source/Property.ts @@ -397,26 +397,8 @@ export default class Property extends Publisher reset() { - let value; - - if (this.isMulti()) { - let multiArray: T[] = this.value as any; - - if (!multiArray) { - value = multiArray = [] as any; - } - else { - multiArray.length = 1; - } - - multiArray[0] = this.clonePreset(); - } - else { - value = this.clonePreset(); - } - // set changed flag and push to output links - this.setValue(value); + this.setValue(this.clonePreset()); } setMultiChannelCount(count: number) @@ -477,7 +459,7 @@ export default class Property extends Publisher return Array.isArray(this.schema.preset); } - isMulti(): boolean + isMulti(): this is Property { return !!this.schema.multi; }