You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2023/11/30 19:12:18 UTC
(superset) 02/02: fixing the window shim so it runs on problematic node versions
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch scarf-pixel
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 2e3a76458085778ac00d48ea8c2032831bc6778e
Author: Evan Rusackas <ev...@rusackas.com>
AuthorDate: Thu Nov 30 12:12:05 2023 -0700
fixing the window shim so it runs on problematic node versions
---
superset-frontend/spec/helpers/shim.tsx | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/superset-frontend/spec/helpers/shim.tsx b/superset-frontend/spec/helpers/shim.tsx
index 152fcc370c..23dd0024b9 100644
--- a/superset-frontend/spec/helpers/shim.tsx
+++ b/superset-frontend/spec/helpers/shim.tsx
@@ -48,15 +48,15 @@ if (defaultView != null) {
}
const g = global as any;
-g.window = g.window || {};
-g.window.location = { href: 'about:blank' };
-g.window.performance = { now: () => new Date().getTime() };
-g.window.Worker = Worker;
-g.window.IntersectionObserver = IntersectionObserver;
-g.window.ResizeObserver = ResizeObserver;
-g.window.featureFlags = {};
-g.URL.createObjectURL = () => '';
-g.caches = new CacheStorage();
+g.window ??= Object.create(window);
+g.window.location ??= { href: 'about:blank' };
+g.window.performance ??= { now: () => new Date().getTime() };
+g.window.Worker ??= Worker;
+g.window.IntersectionObserver ??= IntersectionObserver;
+g.window.ResizeObserver ??= ResizeObserver;
+g.window.featureFlags ??= {};
+g.URL.createObjectURL ??= () => '';
+g.caches ??= new CacheStorage();
Object.defineProperty(window, 'matchMedia', {
writable: true,