Fix staccato/slur listener name collision on nested blocks#5771
Conversation
Include block ID in listener name so nesting staccato inside slur (or vice versa) no longer destroys the outer cleanup listener. Signed-off-by: Ady0333 <adityashinde1525@gmail.com>
|
✅ All Jest tests passed! This PR is ready to merge. |
|
@walterbender and @vanshika2720, the pr is ready review it once. |
kartikktripathi
left a comment
There was a problem hiding this comment.
Confirmed the listener collision fix resolves nested Slur/Staccato articulation leakage and preserves existing behaviour.
Approving. Thanks for the contribution!
@walterbender, this PR is ready to be merged.
vanshika2720
left a comment
There was a problem hiding this comment.
@Ady0333 Scoping the listener name to turtle + "_" + blk correctly isolates nested blocks and fixes the collision issue. The test updates properly reflect the dynamic listener key and validate cleanup behavior.
One small note: if blk is ever undefined, the listener name will include _undefined — not blocking, but worth confirming that’s intentional.
Overall, this is a clean and well-contained fix
I tested runtime calls without a block id (blk undefined) in the console, articulation state stacks and cleans correctly, so there’s no observable leak in that path. Looks safe to me. |
|
@kartikktripathi Thanks for verifying the blk undefined path With that confirmed, this looks safe to merge from my side also. |
Summary
Fixes a listener name collision between Staccato and Slur blocks that caused articulation state to leak when nested.
Both blocks registered their cleanup listeners under the same name (
"_staccato_" + turtle). When nested, the inner block overwrote the outer block’s listener, preventing the outer cleanup from running. This left a phantom entry intur.singer.staccato, causing incorrect articulation for subsequent notes.What changed
Updated the listener name in both
setStaccato()andsetSlur()to include the block id:Before:
const listenerName = "_staccato_" + turtle;After:
const listenerName = "_staccato_" + turtle + "_" + blk;This ensures each block instance registers a unique listener.
Impact
Verification