Skip to content

Commit f180ea5

Browse files
committed
docs(ownts): show the react-scroll-to-bottom leak in its real ES5 form (CodeRabbit)
The benchmark note printed the Composer cleanup as an arrow, which made the leak look detectable by the old arrow-only path and undercut the rationale for parsing `function () {}` cleanups. Show it as the published ES5 `return function () {}` and note it's only reachable after the parser change — the bug is then the capture-mismatch class, not a missing cleanup. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PVeuchch67CtjSbizYm8gi
1 parent 627f44a commit f180ea5

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎docs/notes/ownts-oss-benchmark.md‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,19 @@ Hook *libraries* clean up by design, so the honest hunt for a real leak moved to
130130
(`ScrollToBottom/Composer.js:574`):
131131

132132
```js
133+
// as published — transpiled ES5: a `function () {}` cleanup, not an arrow
133134
target.addEventListener('focus', handleFocus, { capture: true, passive: true });
134-
return () => target.removeEventListener('focus', handleFocus); // default capture (false)
135+
return function () {
136+
return target.removeEventListener('focus', handleFocus); // default capture (false)
137+
};
135138
```
136139

137140
`removeEventListener` must match the capture flag; `capture: true` is added but the
138141
removal uses the default `false`, so the listener is **never removed** — a new one
139-
piles up every time `target` changes. This is exactly the capture-mismatch class the
140-
listener-key matching (P-148/#145) models, and OwnTS flags it. A second real one:
142+
piles up every time `target` changes. (The cleanup is an ES5 `function () {}`, so it
143+
is only reachable after the parser change below; the bug is then the capture-mismatch
144+
class the listener-key matching (P-148/#145) models, not a missing cleanup.) A second
145+
real one:
141146
**`@reactuses/core@6.4.0`** passes `onPressed('mouse')` (a freshly *returned*
142147
function) to both add and remove, so the drag/touch listeners can never be removed.
143148

0 commit comments

Comments
 (0)