fix(inspector): fix leaking event listeners (#22535)
Fixes https://github.com/microsoft/playwright/issues/22348
This commit is contained in:
parent
2b9b46e260
commit
58b3c31f3e
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Reference in a new issue