diff --git a/server/index.ts b/server/index.ts index c4ebeb6..6f7b9b1 100644 --- a/server/index.ts +++ b/server/index.ts @@ -3451,10 +3451,10 @@ const server = Bun.serve({ } } else if (msg.type === "ping") { ws.send(JSON.stringify({ type: "pong", timestamp: msg.timestamp })); - } else if (msg.type === "presence") { + } else if (msg.type === "presence" || msg.type === "presence-leave") { const clients = communityClients.get(communitySlug); if (clients) { - const presenceMsg = JSON.stringify({ type: "presence", peerId, ...msg }); + const presenceMsg = JSON.stringify({ ...msg, peerId }); for (const [clientPeerId, client] of clients) { if (clientPeerId !== peerId && client.readyState === WebSocket.OPEN) { client.send(presenceMsg); diff --git a/shared/components/rstack-collab-overlay.ts b/shared/components/rstack-collab-overlay.ts index e289b7a..fe8a023 100644 --- a/shared/components/rstack-collab-overlay.ts +++ b/shared/components/rstack-collab-overlay.ts @@ -106,6 +106,7 @@ export class RStackCollabOverlay extends HTMLElement { window.removeEventListener('rspace-doc-subscribe', this.#onDocSubscribe); this.#unsubAwareness?.(); this.#unsubPresence?.(); + this.#unsubLeave?.(); this.#stopMouseTracking(); this.#stopFocusTracking(); }