Repository navigation
Conversation
Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>
Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>
|
@hakarrr is attempting to deploy a commit to the Darkroom Team on Vercel. A member of the Team first needs to authorize it. |
4 tasks done
Mekwek
removed their request for review
November 7, 2026 04:00
This branch has not been deployed
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.
What & why
The unsubscribe callback returned by
addElement()deletes theSnapElementfrom the map without calling itsdestroy()method. Its body and elementResizeObservers remain connected. CallingSnap.destroy()later does not clean them up either, because the removed element is no longer in the map. The same happens throughaddElements().Destroy the element before deleting its map entry. The optional lookup makes repeat unsubscribe safe, and the existing deletion return value is preserved. Other registered elements stay active.
Found during lifecycle testing of the snap plugin; there is no separate issue. This is independent of the horizontal alignment fix in #565.
How to verify
bun test packages/snap/tests/unsubscribe.test.js bun run build bunx biome check packages/snap/src/snap.ts packages/snap/tests/unsubscribe.test.jsThe three regressions cover single unsubscribe followed by destroy, group unsubscribe while another element remains registered, and repeated unsubscribe. All three fail against the base and pass with this change. Build and the focused Biome check pass.
Also checked the built browser bundle in Chromium using real
ResizeObservers (subclassed only to recorddisconnect()calls), a real DOM element, and a minimal Lenis event stub. Afterremove(); snap.destroy(), both observers remain connected on the base and both are disconnected with the fix. No dependencies added.Checklist