Browse Source
Merge pull request #12840 from maxunbearable/fix/5683-timeseries-table-export
Handeled deepClone of Observable
pull/12883/head
Igor Kulikov
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
5 additions and
1 deletions
-
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<T>(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; |
|
|
|
} |
|
|
|
|