Plugins: Make datasource instances live targets for the sandbox (#71472)

This commit is contained in:
Esteban Beltran 2023-07-13 15:44:52 +02:00 committed by GitHub
parent a42bab9c97
commit 0db1d16c09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
import { isNearMembraneProxy, ProxyTarget } from '@locker/near-membrane-shared';
import { DataSourceApi } from '@grafana/data';
import { config } from '@grafana/runtime';
import { forbiddenElements } from './constants';
@ -107,7 +108,7 @@ export function patchObjectAsLiveTarget(obj: unknown) {
!(obj instanceof Function) &&
// conditions for allowed objects
// react class components
isReactClassComponent(obj)
(isReactClassComponent(obj) || obj instanceof DataSourceApi)
) {
Reflect.defineProperty(obj, SANDBOX_LIVE_VALUE, {});
}