chore: Remove @juggle/resize-observer polyfill (#14204)

This commit is contained in:
Tom Moor authored and GitHub committed 2026-10-21 18:19:04 -04:00
1 parent 7f4b67cd7a
commit 418752c096
5 files changed
+13 -87

No files matched your search

-32
View File
@@ -1,32 +0,0 @@
import * as React from "react";
import Logger from "~/utils/Logger";
import { loadPolyfills } from "~/utils/polyfills";
type Props = {
children?: React.ReactNode;
};
/**
* Asynchronously load required polyfills. Should wrap the React tree.
*/
export const LazyPolyfill: React.FC<Props> = ({ children }: Props) => {
const [isLoaded, setIsLoaded] = React.useState(false);
React.useEffect(() => {
loadPolyfills()
.then(() => {
setIsLoaded(true);
})
.catch((error) => {
Logger.error("Polyfills failed to load", error);
});
}, []);
if (!isLoaded) {
return null;
}
return <>{children}</>;
};
export default LazyPolyfill;
+12 -15
View File
@@ -21,7 +21,6 @@ import Toasts from "~/components/Toasts";
import env from "~/env";
import { initI18n } from "~/utils/i18n";
import Desktop from "./components/DesktopEventHandler";
import LazyPolyfill from "./components/LazyPolyfills";
import PageScroll from "./components/PageScroll";
import Routes from "./routes";
import Logger from "./utils/Logger";
@@ -76,20 +75,18 @@ if (element) {
<ActionContextProvider>
<ErrorBoundary showTitle>
<KBarProvider actions={[]} options={commandBarOptions}>
<LazyPolyfill>
<LazyMotion features={domMax}>
<PageScroll>
<PageTheme />
<ScrollToTop>
<Routes />
</ScrollToTop>
<Toasts />
<Dialogs />
<Presentation />
<Desktop />
</PageScroll>
</LazyMotion>
</LazyPolyfill>
<LazyMotion features={domMax}>
<PageScroll>
<PageTheme />
<ScrollToTop>
<Routes />
</ScrollToTop>
<Toasts />
<Dialogs />
<Presentation />
<Desktop />
</PageScroll>
</LazyMotion>
</KBarProvider>
</ErrorBoundary>
</ActionContextProvider>
+1 -31
View File
@@ -54,34 +54,4 @@ if (typeof String.prototype.isWellFormed !== "function") {
});
}
/**
* Loads required polyfills.
*
* @returns A promise that resolves when all required polyfills are loaded
*/
export async function loadPolyfills() {
const polyfills = [];
if (!supportsResizeObserver()) {
polyfills.push(
import("@juggle/resize-observer").then((module) => {
window.ResizeObserver = module.ResizeObserver;
})
);
}
return Promise.all(polyfills);
}
/**
* Detect ResizeObserver compatibility.
*
* @returns true if the current browser supports ResizeObserver
*/
function supportsResizeObserver() {
return (
"ResizeObserver" in window &&
"ResizeObserverEntry" in window &&
"contentRect" in ResizeObserverEntry.prototype
);
}
export {};
-1
View File
@@ -81,7 +81,6 @@
"@hocuspocus/extension-throttle": "1.1.3",
"@hocuspocus/provider": "1.1.3",
"@hocuspocus/server": "1.1.3",
"@juggle/resize-observer": "^3.4.0",
"@koa/router": "^15.7.0",
"@koa/send": "^6.0.0",
"@linear/sdk": "^97.0.0",
-8
View File
@@ -2462,13 +2462,6 @@ __metadata:
languageName: node
linkType: hard
"@juggle/resize-observer@npm:^3.4.0":
version: 3.4.0
resolution: "@juggle/resize-observer@npm:3.4.0"
checksum: 10c0/12930242357298c6f2ad5d4ec7cf631dfb344ca7c8c830ab7f64e6ac11eb1aae486901d8d880fd08fb1b257800c160a0da3aee1e7ed9adac0ccbb9b7c5d93347
languageName: node
linkType: hard
"@keyv/serialize@npm:^1.1.1":
version: 1.1.1
resolution: "@keyv/serialize@npm:1.1.1"
@@ -14269,7 +14262,6 @@ __metadata:
"@hocuspocus/extension-throttle": "npm:1.1.3"
"@hocuspocus/provider": "npm:1.1.3"
"@hocuspocus/server": "npm:1.1.3"
"@juggle/resize-observer": "npm:^3.4.0"
"@koa/router": "npm:^15.7.0"
"@koa/send": "npm:^6.0.0"
"@linear/sdk": "npm:^97.0.0"