Skip to content

Commit

Permalink
chore: avoid undefined property on Global type (#21631)
Browse files Browse the repository at this point in the history
  • Loading branch information
justinpark authored Oct 3, 2022
1 parent ef78ec6 commit 1574829
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1574829

Please sign in to comment.