Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix(inspector): fix leaking event listeners (#22535)

Max Schmitt58b3c31f3e57
diff --git a/packages/web/src/components/codeMirrorWrapper.tsx b/packages/web/src/components/codeMirrorWrapper.tsx
index 5ff1ab69f3..1010210478 100644
--- a/packages/web/src/components/codeMirrorWrapper.tsx
+++ b/packages/web/src/components/codeMirrorWrapper.tsx
@@ -107,7 +107,7 @@ export const CodeMirrorWrapper: React.FC<SourceProps> = ({
React.useEffect(() => {
if (!codemirror)
return;
- codemirror.off('change', (codemirror as any).listenerSymbol);
+ codemirror.off('change', (codemirror as any)[listenerSymbol]);
(codemirror as any)[listenerSymbol] = undefined;
if (onChange) {
(codemirror as any)[listenerSymbol] = () => onChange(codemirror.getValue());