Sandbox: Fix react class components stale state (#70572)

This commit is contained in:
Esteban Beltran
2023-06-23 17:44:03 +02:00
committed by GitHub
parent 6c25342ecb
commit 53231cb68d
3 changed files with 36 additions and 1 deletions

View File

@ -1,3 +1,5 @@
import React from 'react';
import { SandboxedPluginObject } from './types';
export function isSandboxedPluginObject(value: unknown): value is SandboxedPluginObject {
@ -7,3 +9,7 @@ export function isSandboxedPluginObject(value: unknown): value is SandboxedPlugi
export function assertNever(x: never): never {
throw new Error(`Unexpected object: ${x}. This should never happen.`);
}
export function isReactClassComponent(obj: unknown): obj is React.Component {
return obj instanceof React.Component;
}