Repository navigation
Conversation
🦋 Changeset detectedLatest commit: d893445 The changes in this PR will be included in the next version bump. This PR includes changesets to release 29 packages
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 |
There was a problem hiding this comment.
🟡 Changes recommended
Deleting the line-width cache entry lets subsequent default-width paths inherit text’s wider stroke, so the cache must reflect the actual context width and the regression test must cover this case.
1 open issue
What changed in this PR
This PR addresses Canvas stroke-width inconsistencies after text rendering and retained event references after canvas destruction, targeting issues #2251 and #2253.
Changes:
- Adjusts the optimized renderer’s line-width cache after text rendering.
- Clears reused event propagation paths during
Canvas.destroy(). - Adds focused regression tests and patch changesets for both packages.
| File | Description |
|---|---|
packages/g-lite/src/Canvas.ts |
Clears event paths during canvas destruction. |
packages/g-canvas/src/plugins/canvas-renderer/shapes/styles/Text.ts |
Deletes the cached line width after rendering text. |
.changeset/calm-paths-render.md |
Records patch releases for both fixes. |
__tests__/unit/plugins/canvas-rendering-optimization.spec.ts |
Tests stroke-width restoration after text rendering. |
__tests__/unit/dom/canvas-destroy-event-path.spec.ts |
Tests lifecycle event path cleanup on destruction. |
Review effort: Balanced
| ); | ||
|
|
||
| // Text rendering sets lineWidth directly, bypassing the optimized context cache. | ||
| renderState.currentContext.delete('lineWidth'); |
hustcc
approved these changes
Nov 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Canvas.destroy()to release references to destroyed canvases and detached containers.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.