Merge pull request #12840 from maxunbearable/fix/5683-timeseries-table-export

Handeled deepClone of Observable
This commit is contained in:
Igor Kulikov 2025-03-10 19:11:59 +02:00 committed by GitHub
commit 193493ece6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,7 +15,7 @@
/// ///
import _ from 'lodash'; 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 { catchError, finalize, share } from 'rxjs/operators';
import { DataKey, Datasource, DatasourceData, FormattedData, ReplaceInfo } from '@app/shared/models/widget.models'; import { DataKey, Datasource, DatasourceData, FormattedData, ReplaceInfo } from '@app/shared/models/widget.models';
import { EntityId } from '@shared/models/id/entity-id'; import { EntityId } from '@shared/models/id/entity-id';
@ -331,6 +331,10 @@ export function deepClone<T>(target: T, ignoreFields?: string[]): T {
if (target === null) { if (target === null) {
return target; 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) { if (target instanceof Date) {
return new Date(target.getTime()) as any; return new Date(target.getTime()) as any;
} }