Whiteboard shapes and cursors not replicating across tabs (intermittent). Race condition in SSEHub.Unregister: when the EventSource reconnected (e.g. tab back to foreground), the NEW handler registered a new channel with the same clientID, but the OLD handler (canceled context) ran defer Unregister(clientID) and removed the NEW channel. From then on the tab stopped receiving events — shapes and presence never arrived. Added UnregisterIfCurrent(clientID, ch) which only removes if the channel is still the same, preventing the race. Applied to both whiteboard (features/whiteboard/handler.go) and the todo SSE stream (features/todo/handlers/todo_sse.go).
Double broadcast on whiteboard.ApplyOp already called BroadcastExcept for other tabs, and handleUpdate called another Broadcast to ALL tabs — peers received duplicate events. Fixed: ApplyOp now uses Broadcast (includes originator) and handleUpdate no longer calls Broadcast (internal/collab/sync_web.go, features/whiteboard/handler.go).
Added
Regression tests for UnregisterIfCurrent.TestSSEHub_UnregisterIfCurrent_PreventsStaleCleanup simulates the exact EventSource reconnection race condition; TestSSEHub_UnregisterIfCurrent_NormalCleanup verifies the normal case still works (internal/queue/ssehub_test.go).