fix(highlighter): clean up stale rough-notation instances on prop changes#929
Merged
Yeom-JinHo merged 1 commit intomagicuidesign:mainfrom Mar 19, 2026
Merged
Conversation
|
@Yeom-JinHo is attempting to deploy a commit to the product-studio Team on Vercel. A member of the Team first needs to authorize it. |
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.
Description
This PR fixes the Highlighter bug reported in #836 where changing the annotation color could leave the previous rough-notation markup in the DOM, causing multiple highlights to stack.
The Highlighter lifecycle now cleans up the exact annotation instance created by each render, and the annotation setup runs in a layout effect so stale markup is removed before repaint. The related registry artifacts were also regenerated to keep the published output in sync.
Fixes #836.
Changes
useEffecttouseLayoutEffect.ResizeObserverbehavior while binding it only to the current annotation instance.pnpm --filter=www typecheckandpnpm --filter=www build:registry.Motivation
When the Highlighter color changed, especially during theme updates, the previous annotation was not always cleaned up before a new one was drawn. This resulted in duplicated highlight strokes and inconsistent visual output.
This change makes the cleanup deterministic and prevents stale annotations from remaining in the DOM across prop updates.
Breaking Changes
None.