You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(stream): removing a listener during join notification skips a sibling callback #2029
In SDK v12.12.0, removing a listener inside its own subscription callback can cause the next caller on the same topic to miss the join result. This is a follow-up edge case to the callback cleanup added for #2027, not the original reconnect bug.
Steps to reproduce
Using the existing mock WebSocket and PhoenixChannelsTransport helpers (no OpenSea API calls):
Subscribe callers A and B to collection:c1. Each registers an ITEM_SOLD handler and an onSubscribed callback.
In A's onSubscribed, call the unsubscribe function returned by A's .on(...).
Acknowledge the initial phx_join.
A focused test on current main fails at expect(second).toHaveBeenCalledTimes(1) with 0 calls. The same behavior occurs if A removes its handler inside onSubscribeError after a rejected join.
Expected behavior
A and B should each receive one join-result notification. Removing A should not skip B.
Environment
Package version: 12.12.0 (main at 8ed5cd6)
Node.js version: 22.21.0
Operating system: macOS 15.6.1
Chain / network: none; offline mock WebSocket
Additional context
callerHandle() splices A from subscription.callbackList when its last handler is removed, while sendJoin() iterates that same array. B shifts into A's index and is skipped. The success, error and timeout paths all iterate the live list.
Locally, iterating a snapshot in those three paths makes both new regression tests pass. With that small change, all 54 transport tests and 1,302 SDK unit tests pass, as do check-types, build, and Biome on the affected files. No live stream or API request was made.
Since this repository mirrors an internal monorepo, I am filing the reproducible bug here first rather than assuming a PR can be merged directly. I can share the focused test and patch if useful.
Thanks for the precise report. Your diagnosis was exactly right, and the mock WebSocket repro made it easy to confirm. The fix from #2030 has been recreated internally and will be in the next @opensea/sdk patch release. Closing this once it ships.
Activity
ryanio commentedon Oct 16, 2026
Thanks for the precise report. Your diagnosis was exactly right, and the mock WebSocket repro made it easy to confirm. The fix from #2030 has been recreated internally and will be in the next
@opensea/sdkpatch release. Closing this once it ships.