From 58b3c31f3e57ad2429e61798238063679e7f668d Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Thu, 20 Apr 2023 22:42:34 +0200 Subject: [PATCH] fix(inspector): fix leaking event listeners (#22535) Fixes https://github.com/microsoft/playwright/issues/22348 --- packages/web/src/components/codeMirrorWrapper.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 = ({ 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());