diff --git a/src/data_sources/model/DataRecord.ts b/src/data_sources/model/DataRecord.ts index cdb90333d..c2c6772f8 100644 --- a/src/data_sources/model/DataRecord.ts +++ b/src/data_sources/model/DataRecord.ts @@ -139,26 +139,17 @@ export default class DataRecord ext set(attributeName: unknown, value?: unknown, options?: SetOptions): DataRecord { const onRecordSet = this.dataSource?.transformers?.onRecordSet; - if (options?.avoidTransformers) { - // @ts-ignore - super.set(attributeName, value, options); - return this; - } + const newValue = + options?.avoidTransformers || !onRecordSet + ? value + : onRecordSet({ + id: this.id, + key: attributeName as string, + value, + }); - if (onRecordSet) { - const newValue = onRecordSet({ - id: this.id, - key: attributeName as string, - value, - }); + super.set(attributeName as string, newValue, options); - // @ts-ignore - super.set(attributeName, newValue, options); - return this; - } else { - // @ts-ignore - super.set(attributeName, value, options); - return this; - } + return this; } }