Skip to content

fix(interaction): reuse and release series brush clip paths - #8575

Merged
lxfu1 merged 1 commit into
antvis:v5from
dvd233:codex/fix-series-brush-clip-path
Oct 15, 2026
Merged

lxfu1 merged 1 commit into
antvis:v5from
dvd233:codex/fix-series-brush-clip-path

Conversation

@dvd233

@dvd233 dvd233 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor
Checklist
  • npm test passes (see the Windows validation note below; upstream CI pending)
  • commit message follows commit guidelines
Description of change

With brushHighlight: { series: true }, every brush update appends a new shared clipping rectangle. Replacing the clones' clip path leaves earlier rectangles attached to the plot, and removing the brush or destroying the interaction does not release them.

Reuse one shared rectangle while the brush is active and release it through the existing cleanup path. Add five integration cases covering repeated moves, reverse brushing, removal, interaction destruction, and ordinary element brushing. Update six focus/context snapshots to remove only obsolete clipping rectangles; visible geometry and the active clipping region remain unchanged.

Validation:

  • The same five new tests fail four lifecycle assertions on the original source and pass all five with the fix.
  • Full lint and CJS, ESM, and UMD builds, including the existing size checks, pass.
  • In a browser running the current source, a 20-step drag previously left 21 clipping rectangles after removal. The fix keeps one active rectangle and leaves none after removal or destruction. Before/after images for initial, highlighted, moved, and removed states are identical.
  • Full-suite validation with the local LF serializer option below: 948 tests passed, 25 existing tests skipped, no failures (136 files passed, 15 skipped). All eight added executable lines are covered. The final run leaves all eight PR files unchanged.

Windows validation note: SVGO emits CRLF on Windows while the repository SVG goldens use LF. Full-suite validation therefore temporarily sets its supported js2svg.eol: 'lf' serializer option, without changing test selection, assertions, timeouts, or coverage. The helper is restored afterward, and this local option is not part of the PR.

@hustcc

hustcc commented Oct 13, 2026

Copy link
Copy Markdown
Member

@dvd233 Does this problem cause a memory leak?

@dvd233

dvd233 commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

Yes: the obsolete clipping rectangles remain attached to the scenegraph and accumulate with brush updates, so they stay reachable after the brush is removed. In the recorded browser reproduction, a 20-step drag left 21 rectangles after removal. With this branch, there is one active rectangle and none after removal or interaction destruction. I did not perform heap profiling or measure leaked bytes, so the evidence is retained scenegraph objects rather than a quantified heap-growth claim. The five lifecycle regression tests and before/after browser checks described in the PR cover this behavior.

@lxfu1
lxfu1 merged commit a5a1663 into antvis:v5 Oct 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants