Merge pull request #12840 from maxunbearable/fix/5683-timeseries-table-export
Handeled deepClone of Observable
This commit is contained in:
commit
193493ece6
@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user