SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
fix(overlayscrollbars): leaking memory due to img.load event listener (#12179)
Vinicius Lourençoe93792d427d7
diff --git a/frontend/package.json b/frontend/package.jsonindex 9072afdad9..ac19becf8d 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -89,7 +89,7 @@"lodash-es": "^4.17.21","motion": "12.4.13","nuqs": "2.8.8",- "overlayscrollbars": "^2.8.1",+ "overlayscrollbars": "^2.16.0","overlayscrollbars-react": "^0.5.6","papaparse": "5.4.1","posthog-js": "1.298.0",@@ -221,5 +221,18 @@"*.(scss|css)": ["stylelint"]+ },+ "overrides": {+ "@babel/core@<=7.29.0": ">=7.29.6 <8",+ "@istanbuljs/load-nyc-config>js-yaml": ">=4.2.0 <5",+ "cookie@<0.7.0": ">=0.7.1 <1",+ "dompurify@<=3.4.10": ">=3.4.11 <4",+ "esbuild@>=0.27.3 <0.28.1": ">=0.28.1 <0.29.0",+ "js-cookie@<=3.0.5": ">=3.0.7 <4",+ "js-yaml@>=4.0.0 <=4.1.1": ">=4.2.0 <5",+ "prismjs@<1.30.0": ">=1.30.0 <2",+ "react-router@>=6.7.0 <6.30.4": ">=6.30.4 <7",+ "tmp@<0.2.6": ">=0.2.6 <0.3.0",+ "yaml@>=1.0.0 <1.10.3": ">=1.10.3 <2"}-}\ No newline at end of file+}diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yamlindex 5f149114d4..02169d12e2 100644--- a/frontend/pnpm-lock.yaml+++ b/frontend/pnpm-lock.yaml@@ -187,11 +187,11 @@ importers:specifier: 2.8.8version: 2.8.8([email protected]([email protected]))([email protected]([email protected]))([email protected])overlayscrollbars:- specifier: ^2.8.1- version: 2.9.2+ specifier: ^2.16.0+ version: 2.16.0overlayscrollbars-react:specifier: ^0.5.6- version: 0.5.6([email protected])([email protected])+ version: 0.5.6([email protected])([email protected])papaparse:specifier: 5.4.1version: 5.4.1@@ -6941,8 +6941,8 @@ packages:overlayscrollbars: ^2.0.0react: '>=16.8.0'- resolution: {integrity: sha512-iDT84r39i7oWP72diZN2mbJUsn/taCq568aQaIrc84S87PunBT7qtsVltAF2esk7ORTRjQDnfjVYoqqTzgs8QA==}+ resolution: {integrity: sha512-N03oje/q7j93D0aLZtoCdsDSYLmhheSsv8H7oSLE7HhdV9P/bmCURtLV/KbPye7P/bpfyt/obSfDpGUYoJ0OWg==}resolution: {integrity: sha512-DjnMwn7smSLF+Mc2+pRItnuPftm/dkUFpY/d4+33y9TfKrsHZo8GLhmUg9BrOIUEy94Rlom1Q11N6vuhE+e0oQ==}@@ -16456,12 +16456,12 @@ snapshots:dependencies:- overlayscrollbars: 2.9.2+ overlayscrollbars: 2.16.0react: 18.2.0- [email protected]: {}+ [email protected]: {}dependencies:diff --git a/frontend/src/index.tsx b/frontend/src/index.tsxindex 47bd7af733..d705576b2a 100644--- a/frontend/src/index.tsx+++ b/frontend/src/index.tsx@@ -7,6 +7,7 @@ import AppRoutes from 'AppRoutes';import { AxiosError } from 'axios';import { GlobalTimeStoreAdapter } from 'components/GlobalTimeStoreAdapter/GlobalTimeStoreAdapter';import { ThemeProvider } from 'hooks/useDarkMode';+import { configureOverlayScrollbars } from 'lib/configureOverlayScrollbars';import { NuqsAdapter } from 'nuqs/adapters/react';import { AppProvider } from 'providers/App/App';import TimezoneProvider from 'providers/Timezone';@@ -17,6 +18,8 @@ import './ReactI18';import 'styles.scss';+configureOverlayScrollbars();+const queryClient = new QueryClient({defaultOptions: {queries: {diff --git a/frontend/src/lib/configureOverlayScrollbars.ts b/frontend/src/lib/configureOverlayScrollbars.tsnew file mode 100644index 0000000000..9eeec1975b--- /dev/null+++ b/frontend/src/lib/configureOverlayScrollbars.ts@@ -0,0 +1,22 @@+import { OverlayScrollbars } from 'overlayscrollbars';++/**+ * Disables the content `elementEvents` option (default: `[['img', 'load']]`)+ * for every OverlayScrollbars instance.+ *+ * The per-element event cleanups OverlayScrollbars stores in its internal+ * WeakMap close over the MutationObserver callback scope, which holds arrays+ * with every node added/removed in that mutation batch. A single long-lived+ * reference to one of those elements (e.g. CodeMirror's EditContext or its+ * module-level scratch Range pinning a detached editor) then retains entire+ * unmounted subtrees as detached DOM — ~1.3k nodes per InfraMonitoring+ * category switch.+ *+ * Content size changes from loading images are still handled by the+ * scrollbars' size observer, so scrollbar geometry stays correct.+ */+export function configureOverlayScrollbars(): void {+ OverlayScrollbars.env().setDefaultOptions({+ update: { elementEvents: null },+ });+}