diff --git a/ui-ngx/src/app/core/utils.ts b/ui-ngx/src/app/core/utils.ts index 83c253f64c..c37cae599e 100644 --- a/ui-ngx/src/app/core/utils.ts +++ b/ui-ngx/src/app/core/utils.ts @@ -15,7 +15,7 @@ /// import _ from 'lodash'; -import { from, Observable, of, ReplaySubject, Subject } from 'rxjs'; +import { from, isObservable, Observable, of, ReplaySubject, Subject } from 'rxjs'; import { catchError, finalize, share } from 'rxjs/operators'; import { DataKey, Datasource, DatasourceData, FormattedData, ReplaceInfo } from '@app/shared/models/widget.models'; import { EntityId } from '@shared/models/id/entity-id'; @@ -331,6 +331,10 @@ export function deepClone(target: T, ignoreFields?: string[]): T { if (target === null) { return target; } + // Observables can't be cloned using the spread operator, because they have non-enumerable methods (like .pipe). + if (isObservable(target)) { + return target; + } if (target instanceof Date) { return new Date(target.getTime()) as any; }