chore: avoid undefined property on `Global` type (#21631)
This commit is contained in:
parent
ef78ec6b30
commit
157482955e
|
|
@ -105,7 +105,9 @@ describe('comms', () => {
|
|||
let originalConsoleError: any = null;
|
||||
|
||||
beforeAll(() => {
|
||||
global.MessageChannel = FakeMessageChannel; // yolo
|
||||
Object.defineProperty(global, 'MessageChannel', {
|
||||
value: FakeMessageChannel,
|
||||
});
|
||||
originalConsoleDebug = console.debug;
|
||||
originalConsoleError = console.error;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ const DashboardBuilder: FC<DashboardBuilderProps> = () => {
|
|||
setBarTopOffset(headerRef.current?.getBoundingClientRect()?.height || 0);
|
||||
|
||||
let observer: ResizeObserver;
|
||||
if (typeof global.ResizeObserver !== 'undefined' && headerRef.current) {
|
||||
if (global.hasOwnProperty('ResizeObserver') && headerRef.current) {
|
||||
observer = new ResizeObserver(entries => {
|
||||
setBarTopOffset(
|
||||
current => entries?.[0]?.contentRect?.height || current,
|
||||
|
|
|
|||
Loading…
Reference in New Issue