Skip to content

fix(canvas): restore cached state after text and destroy - #2271

Open
dajiaohuang wants to merge 1 commit into
antvis:masterfrom
dajiaohuang:fix/canvas-renderer-style-cache-and-event-retention
Open

dajiaohuang wants to merge 1 commit into
antvis:masterfrom
dajiaohuang:fix/canvas-renderer-style-cache-and-event-retention

Conversation

@dajiaohuang

Copy link
Copy Markdown

Summary

  • Invalidate the optimized Canvas line-width cache after text rendering writes directly to the context, so a following path reapplies its requested stroke width.
  • Clear propagation paths on reused lifecycle events during Canvas.destroy() to release references to destroyed canvases and detached containers.
  • Add focused regression tests and a patch changeset.

Closes #2251 and #2253.

Validation

  • pnpm exec jest --config jest.unit.config.js --runInBand __tests__/unit/plugins/canvas-rendering-optimization.spec.ts __tests__/unit/dom/canvas-destroy-event-path.spec.ts — 2 suites, 2 tests passed.
  • Targeted ESLint passed for changed TypeScript files.
  • Prettier check passed for changed files.

@changeset-bot

changeset-bot Bot commented Oct 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d893445

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 29 packages
Name Type
@antv/g-canvas Patch
@antv/g-lite Patch
@antv/g-canvaskit Patch
@antv/g-mobile-canvas Patch
@antv/g-plugin-rough-canvas-renderer Patch
@antv/g-plugin-zdog-canvas-renderer Patch
@antv/g-web-components Patch
@antv/g-lottie-player Patch
@antv/g-mobile-svg Patch
@antv/g-mobile-webgl Patch
@antv/g-plugin-3d Patch
@antv/g-plugin-a11y Patch
@antv/g-plugin-annotation Patch
@antv/g-plugin-box2d Patch
@antv/g-plugin-control Patch
@antv/g-plugin-css-select Patch
@antv/g-plugin-device-renderer Patch
@antv/g-plugin-dragndrop Patch
@antv/g-plugin-gesture Patch
@antv/g-plugin-matterjs Patch
@antv/g-plugin-physx Patch
@antv/g-plugin-rough-svg-renderer Patch
@antv/g-plugin-yoga Patch
@antv/g-plugin-zdog-svg-renderer Patch
@antv/g-svg Patch
@antv/g-webgl Patch
@antv/g-webgpu Patch
@antv/g Patch
@antv/react-g Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This branch has not been deployed

No deployments
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.

[g-canvas] Path lineWidth can be rendered incorrectly with enableRenderingOptimization

1 participant